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
Lets say my use case is, There are 2 processes trying to acquire lock on some key. One of them succeed, while other will just wait. Once first one is done updating the value it should release lock and then 2nd process can acquire lock if want or use the value updated by 1st one. I am talking about similar methods from StackExchange.Redis for c#
LockTake
LockRelease
LockExtend
LockQuery
The text was updated successfully, but these errors were encountered:
nidhijha
changed the title
How to implement lock using redis3m. Lets say my use case is, There are 2 processes trying to acquire lock on some key. One of them succeed, while other will just wait. Once first one is done updating the value it should release lock and then 2nd process can acquire lock if want or use the value updated by 1st one.
How to implement lock using redis3m.
Feb 25, 2015
Lock are implemented in Redis using SET command and its options. StackExchange.Redis does the same as I can see on their code. So you can issue these commands using redis3m too, for example the lockTake should look in this way:
usingnamespaceredis3m;
connection::ptr_t conn = connection::create();
conn->run(command("SET") << "lockname" << "EX" << expiretime << "NX");
// if response is OK you have got the lock, otherwise you don't have it
I called these common features patterns. You can find some here, they are included on redis3m. If you want you can create a new one for locks and we can include it on redis3m.
Lets say my use case is, There are 2 processes trying to acquire lock on some key. One of them succeed, while other will just wait. Once first one is done updating the value it should release lock and then 2nd process can acquire lock if want or use the value updated by 1st one. I am talking about similar methods from StackExchange.Redis for c#
The text was updated successfully, but these errors were encountered: