Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cacher ¶
type Cacher interface { // Get an item from the cache. Returns the item or nil, and a bool indicating whether the key was found. Get(key string) (*Item, bool) // Set an item to the cache, replacing any existing item. Set(key string, ttl time.Duration, item *Item) // Count returns the number of items in the cache. Count() uint32 }
Cacher interface describes something, who can read and write data into fast storage (faster than local filesystem).
type InMemoryCache ¶
type InMemoryCache struct {
// contains filtered or unexported fields
}
InMemoryCache implements Cacher interface and uses memory as a storage.
func NewInMemoryCache ¶
func NewInMemoryCache(cleanupInterval time.Duration) *InMemoryCache
NewInMemoryCache creates cacher implementation, that uses memory as a storage.
func (*InMemoryCache) Count ¶
func (c *InMemoryCache) Count() uint32
Count returns the number of items in the cache. This may include items that have expired, but have not yet been cleaned up.
Click to show internal directories.
Click to hide internal directories.