class Agave::LockPool

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:

EXPERIMENTAL Acquiring locks on keys is experimental and not yet guaranteed to work in a multithreaded environment

Defined in:

lock_pool.cr

Constant Summary

Log = ::Log.for(self)

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def lock(key : String, &) #

Acquire a lock for the given key.


[View source]