Database.Redis.Utils.Lock

redis-0.13: A driver for Redis key-value database

Safe Haskell | None

Database.Redis.Utils.Lock

Description

Emulating locking primitives

Synopsis

- acquire :: BS s => Redis -> s -> Int -> Int -> IO Bool
- acquire' :: BS s => Redis -> s -> Int -> IO Bool
- acquireOnce :: BS s1 => Redis -> s1 -> IO Bool
- release :: BS s => Redis -> s -> IO ()

# Documentation

acquire

Arguments

:: BS s |
=> Redis |
-> s | The lock's name
-> Int | Timeout in milliseconds.
-> Int | Time interval between attempts to lock on
-> IO Bool | True if lock was acquired

Acquire lock. This function is not reentrant so thread can be locked by itself if it try to acquire the same lock before it was released.

acquire' :: BS s => Redis -> s -> Int -> IO Bool

acquire with default last parameter set to 50 milliseconds

acquireOnce :: BS s1 => Redis -> s1 -> IO Bool

Try to acquire lock once and return result without any timeout

release :: BS s => Redis -> s -> IO ()

Release lock. There is no any guarantees that lock was acquired in this thread. Just release this lock and go forth.