In-memory cache of a machine ID and its lease.
The purpose of the cache is to allow the lease to resume if the LeaseManager crashes for whatever reason, for example if a lease strategy does not properly catch all errors. In that case, the lease manager will be restarted, can fetch the existing lease from the cache and attempt to renew it. This way, the lease manager does not have to request a new lease, protecting against ID exhaustion, of which there are only 512 after all.
Since this is an in-memory cache, it will not protect against node crashes or, notably, external forced kills by the kernel or the scheduler (for example in OOM scenarios).
Summary
Functions
Returns a specification to start this module under a supervisor.
Returns the cached lease state, or nil when no lease has been cached.
Replaces the cached lease state.
Starts an empty in-memory lease cache.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec get(GenServer.name()) :: term()
Returns the cached lease state, or nil when no lease has been cached.
@spec put(GenServer.name(), term()) :: :ok
Replaces the cached lease state.
@spec start_link([{:name, GenServer.name()}]) :: Agent.on_start()
Starts an empty in-memory lease cache.