Documentation ¶
Overview ¶
Package hashcache implements a simple cache intended to be indexed by hash values. The keys are of type []byte. Values are arbitrary interface{} values. Entries may expire if not used for a duration specified by the client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
A Cache allows the user to store arbitrary values, keyed by the contents of byte vectors. Entries may be added, deleted, and looked up. They may expire if not used.
func New ¶
New() returns a pointer to a new, empty Cache. Entries may expire if not used for "expiry".
func (*Cache) Add ¶
Add() associates data with key[] in *c. Any data previously associated with key[] are forgotten. The implementation may discard the association at some future time (set by NewCache()) to limit the size of the cache. data may not be modified after this call; it is shared with *c.