Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ARC ¶
type ARC[K comparable, V any] struct { // contains filtered or unexported fields }
func New ¶
func New[K comparable, V any](options ...Option[K, V]) *ARC[K, V]
New returns a new Adaptive Replacement Cache (ARC).
func (*ARC[K, V]) Get ¶
Get retrieves a previously via Set inserted entry. This optimizes future access to this entry (side effect).
func (*ARC[K, V]) GetWithExpire ¶
GetWithExpire returns any representation of a cached response, a time.Time Give expected expires, and a bool set to true if the key was found. This method will NOT check the maxAge of element and will NOT update the expires.
func (*ARC[K, V]) Len ¶
Len determines the number of currently cached entries. This method is side-effect free in the sense that it does not attempt to optimize random cache access.
func (*ARC[K, V]) Set ¶
func (a *ARC[K, V]) Set(key K, value V)
Set inserts a new key-value pair into the cache. This optimizes future access to this entry (side effect).
func (*ARC[K, V]) SetWithExpire ¶
SetWithExpire stores any representation of a response for a given key and given expires. The expires time will round to second.