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_in
will be the expiration of every cache entry;#fetch
and#write
are overridden to no longer accept this.- If
clean_every
is non-nil, starts a background task that runs#cleanup
on this interval. - If
log
is non-nil, the background task emits an info log indicating how many entries were cleaned, when greater than zero.