You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-11
Original file line number
Diff line number
Diff line change
@@ -971,22 +971,22 @@ An HTML dashboard can be found at `http://127.0.0.1:4001/mod/dashboard/```
971
971
### Lock
972
972
973
973
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.
977
977
978
978
Here's the API:
979
979
980
-
**Acquire a lock (with no name) for "customer1"**
980
+
**Acquire a lock (with no value) for "customer1"**
981
981
982
982
```sh
983
983
curl -X POST http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60
984
984
```
985
985
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"**
987
987
988
988
```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
990
990
```
991
991
992
992
**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
995
995
curl -X PUT http://127.0.0.1:4001/mod/v2/lock/customer1?ttl=60 -d index=2
996
996
```
997
997
998
-
**Renew the TTL on the "customer1" lock for name "customer1"**
998
+
**Renew the TTL on the "customer1" lock for value "customer1"**
999
999
1000
1000
```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
1002
1002
```
1003
1003
1004
-
**Retrieve the current name for the "customer1" lock.**
1004
+
**Retrieve the current value for the "customer1" lock.**
0 commit comments