Skip to main content

Module cache_links

Module cache_links 

Source
Expand description

A links store used as a cache: links can expire, and the store can be kept to a number of links by evicting the ones used least recently. It has the API of any other store, so only a store that selects it pays for it. See docs/ENGINE-CACHE.md. The C# twin is CacheLinksDecorator<TLinkAddress>, the JavaScript one CacheLinks of @link-foundation/link-cli-client.

The two rules differ on purpose. A deadline is a promise, so a link that comes due is deleted with whatever the store’s own delete takes with it. Capacity only has to free a place, so it evicts a link nothing else uses and takes nothing else along. When every link is in use the create is refused.

There is no worker. Everything due is deleted by the next call that touches the store, or by CacheLinks::purge_expired when a caller wants to run it on a timer. Deadlines live in memory: a store opened again has links without one.

Structs§

CacheLinks
links kept as CacheOptions tell; see the top of this module. Every write has to go through it for it to know which links exist.
CacheOptions
What a CacheLinks enforces. Each is optional, and the default is neither.