class Agave::LockPool
- Agave::LockPool
- Reference
- Object
Overview
The LockPool concept is for obtaining a lock on a key. For example, when we increment a number or push to a list, the key is created with the appropriate default value (0, empty array, etc) and the operation is performed on that value. This isn't actually useful for a single-threaded environment since fibers aren't preempted; they have to yield the CPU themselves. But when we start looking at running multithreaded, we'll need these locks for these scenarios.
An incomplete list of scenarios where this may be needed:
- Incrementing a key that may not exist
- LPUSHing to a key that may not exist
- SETting a key with NX or XX
EXPERIMENTAL Acquiring locks on keys is experimental and not yet guaranteed to work in a multithreaded environment
Defined in:
lock_pool.crConstant Summary
-
Log =
::Log.for(self)
Constructors
Instance Method Summary
-
#lock(key : String, &)
Acquire a lock for the given key.