Documentation ¶
Index ¶
- type SDLRU
- type SLRU
- func (s *SLRU) Delete(key string) (interface{}, bool)
- func (s *SLRU) Get(key string) (interface{}, bool)
- func (s *SLRU) Iter(f func(key string, v interface{}) bool)
- func (s *SLRU) Set(key string, v interface{}) bool
- func (s *SLRU) Size() int
- func (s *SLRU) String() string
- func (s *SLRU) TailRemove(f func(key string, v interface{}) bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SDLRU ¶
type SDLRU struct {
// contains filtered or unexported fields
}
SDLRU is an LRU for strings with a maximum age
func NewStringDecayLRU ¶
NewStringDecayLRU creates a new string LRU with a maximum capacity. TODO: decay mechanism?
func (*SDLRU) Add ¶
Add adds the given value and returns true if the value was in the cache.
func (*SDLRU) AddUnless ¶
AddUnless adds/refreshes the value and returns true if the value is not in the cache or if it is older than delta.
func (*SDLRU) Check ¶
Check checks if the value is in the cache and not older than ts by delta seconds.
func (*SDLRU) Delete ¶
Delete removes a key from the LRU and returns if the key was in the cache.
func (*SDLRU) Iter ¶
Iter iterates over all values in the cache.
type SLRU ¶
type SLRU struct {
// contains filtered or unexported fields
}
SLRU is an LRU for strings
func NewStringLRU ¶
NewStringLRU creates a new string LRU with a maximum capacity.
func (*SLRU) Delete ¶
Delete removes a key from the LRU and returns if the key was in the cache.
func (*SLRU) Get ¶
Get returns the value associated with the key, if it is in the cache.
func (*SLRU) Iter ¶
Iter iterates over the list values in most-recent-to-last order,
func (*SLRU) Set ¶
Set adds the given value and returns true if the value was already in the cache.
func (*SLRU) String ¶
String returns a string representation of the LRU entries for debugging.