Skip to content

Commit 4748da1

Browse files
committed
Merge pull request #415 from philips/fix-lock-docs
fix(README): fixup lock docs
2 parents f026d1c + c3b4d10 commit 4748da1

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Diff for: README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -971,22 +971,22 @@ An HTML dashboard can be found at `http://127.0.0.1:4001/mod/dashboard/```
971971
### Lock
972972

973973
The Lock module implements a fair lock that can be used when lots of clients want access to a single resource.
974-
A lock can be associated with a name.
975-
The name is unique so if a lock tries to request a name that is already queued for a lock then it will find it and watch until that name obtains the lock.
976-
If you lock the same name on a key from two separate curl sessions they'll both return at the same time.
974+
A lock can be associated with a value.
975+
The value is unique so if a lock tries to request a value that is already queued for a lock then it will find it and watch until that value obtains the lock.
976+
If you lock the same value on a key from two separate curl sessions they'll both return at the same time.
977977

978978
Here's the API:
979979

980-
**Acquire a lock (with no name) for "customer1"**
980+
**Acquire a lock (with no value) for "customer1"**
981981

982982
```sh
983983
curl -X POST http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60
984984
```
985985

986-
**Acquire a lock for "customer1" that is associated with the name "bar"**
986+
**Acquire a lock for "customer1" that is associated with the value "bar"**
987987

988988
```sh
989-
curl -X POST http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d name=bar
989+
curl -X POST http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d value=bar
990990
```
991991

992992
**Renew the TTL on the "customer1" lock for index 2**
@@ -995,13 +995,13 @@ curl -X POST http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d name=bar
995995
curl -X PUT http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d index=2
996996
```
997997

998-
**Renew the TTL on the "customer1" lock for name "customer1"**
998+
**Renew the TTL on the "customer1" lock for value "customer1"**
999999

10001000
```sh
1001-
curl -X PUT http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d name=bar
1001+
curl -X PUT http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d value=bar
10021002
```
10031003

1004-
**Retrieve the current name for the "customer1" lock.**
1004+
**Retrieve the current value for the "customer1" lock.**
10051005

10061006
```sh
10071007
curl http://127.0.0.1:4001/mod/v2/lock/customer1
@@ -1019,10 +1019,10 @@ curl http://127.0.0.1:4001/mod/v2/lock/customer1?field=index
10191019
curl -X DELETE http://127.0.0.1:4001/mod/v2/lock/customer1?index=customer1
10201020
```
10211021

1022-
**Delete the "customer1" lock with the name "bar"**
1022+
**Delete the "customer1" lock with the value "bar"**
10231023

10241024
```sh
1025-
curl -X DELETE http://127.0.0.1:4001/mod/v2/lock/customer1?name=bar
1025+
curl -X DELETE http://127.0.0.1:4001/mod/v2/lock/customer1?value=bar
10261026
```
10271027

10281028

0 commit comments

Comments
 (0)