Documentation
¶
Overview ¶
Package memory is the in-process ByteCache: a bounded, least-recently-used map whose entries expire at their TTL. It suits a value a service reads often, that rarely changes, and that each replica may hold its own copy of, when no shared cache is deployed; replicas never see each other's writes or deletes.
Index ¶
Constants ¶
View Source
const DefaultMaxEntries = 10_000
DefaultMaxEntries bounds the cache when the configured bound is not positive.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is the in-process ByteCache. It is safe for concurrent use.
func New ¶
New returns a cache holding at most maxEntries values (DefaultMaxEntries when not positive), applying defaultTTL to a zero-TTL Set and measuring expiry with now (time.Now in production).
Click to show internal directories.
Click to hide internal directories.