class

Agave::LockPool

Inherits Reference < Object

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

Constants

Log = ::Log.for(self)

Constructors

Instance methods

lock(key : String, &)

Acquire a lock for the given key.

Source