Skip to content

Redis Distributed lock #4

@nareshkhatri81

Description

@nareshkhatri81

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions