Documentation ¶
Overview ¶
A wrapper for LRU/LFU cache used by httransform
The thing is that there are many (good) caching libraries available in Go. So many so I even think to make my own. But the truth is that I feel a huge discomfort leaking implemetation details in the rest of the code base. When I add a parameter which is unique only for specific implementation and we have to support it until end of the life.
So, the idea of this package is to introduce a minimal interface I'm going to use for httransform.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NoopEvictCallback ¶
func NoopEvictCallback(_ string, _ interface{})
NoopEvictCallback implements EvictCallback which does nothing.
Types ¶
type EvictCallback ¶
type EvictCallback func(string, interface{})
EvictCallback is going to be executed on an entry eviction.
type Interface ¶
type Interface interface { // Add puts a value into the cache. Add(key string, value interface{}) // Get extracts value from the cache. If it is impossible to return // a value, then it returns a nil. Get(key string) interface{} }
Interface defines a minimal set of methods and their signatures which is going to be used everywhere in this library.