Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis Distributed lock #4

Open
nareshkhatri81 opened this issue Aug 21, 2017 · 0 comments
Open

Redis Distributed lock #4

nareshkhatri81 opened this issue Aug 21, 2017 · 0 comments

Comments

@nareshkhatri81
Copy link

Hi,
i am not able to take lock on resource.
its always returning false.
i am running on windows with single instance of redis running.
does it work in distributed env only ?

var dlm = new Redlock.CSharp.Redlock(ConnectionMultiplexer.Connect("127.0.0.1:6379"));

            Lock lockObject;
            Lock newLockObject;

            string resourceName = "test";

            var locked = dlm.Lock(resourceName, new TimeSpan(0, 0, 10), out lockObject);
            //Assert.IsTrue(locked, "Unable to get lock");
            locked = dlm.Lock(resourceName, new TimeSpan(0, 0, 10), out newLockObject);
            //Assert.IsFalse(locked, "lock taken, it shouldn't be possible");
            dlm.Unlock(lockObject);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant