Packages

RedisMutex is a library for creating a Redis lock for a single Redis instance

Current section

Files

Jump to
redis_mutex lib support lock.ex
Raw

lib/support/lock.ex

defmodule RedisMutex.LockMock do
@default_timeout :timer.seconds(40)
@expiry :timer.seconds(20)
@spec with_lock(any, integer) :: any
defmacro with_lock(key, timeout \\ @default_timeout, do: clause) do
quote do
key = unquote(key)
timeout = unquote(timeout)
block_value = unquote(clause)
block_value
end
end
end