class
TCal::Cache(K, V)
- TCal::Cache(K, V)
- MemoryCache(K, V)
- Reference
- Object
Overview
Refinement of MemoryCache with additional behaviors.
Defined in:
t_cal/cache.crConstructors
-
.new(expires_in : Time::Span, clean_every : Time::Span | Nil = nil, log : Log | Nil = nil)
Creates a cache.
Instance Method Summary
Constructor Detail
def self.new(expires_in : Time::Span, clean_every : Time::Span | Nil = nil, log : Log | Nil = nil)
#
Creates a cache.
expires_inwill be the expiration of every cache entry;#fetchand#writeare overridden to no longer accept this.- If
clean_everyis non-nil, starts a background task that runs#cleanupon this interval. - If
logis non-nil, the background task emits an info log indicating how many entries were cleaned, when greater than zero.