public void AcquireTest() { RedisMutex mutex = new RedisMutex("192.168.56.3", ":)"); bool result = mutex.Acquire(10000); Assert.IsTrue(result); result = mutex.Acquire(10000); Assert.IsFalse(result); mutex.Release(); result = mutex.Acquire(10000); Assert.IsTrue(result); }
private RedisMutex BuildMutex(string codeIdentifier, string requestIdentifier) { var mutexIdentifier = "mutex:" + codeIdentifier + ":" + requestIdentifier; RedisMutex mutex = new RedisMutex(redisServerUri, mutexIdentifier); bool result = mutex.Acquire(100000); return(mutex); }