Documentation
¶
Overview ¶
Package cache providers a scalable cache component.
Index ¶
- type Cache
- type Item
- func (i *Item) HasExpired() bool
- func (i *Item) MarshalGob() ([]byte, error)
- func (i *Item) SetAbsoluteExpiration(Absolute time.Time)
- func (i *Item) SetDependencies(Dependencies ...dependency.Dependency)
- func (i *Item) SetSlidingExpiration(Sliding time.Duration)
- func (i *Item) UnmarshalGob(data []byte) error
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
}
Cache represents a cache manager.
func (*Cache) Get ¶
Get returns the cache item by given key. It returns nil if cache item has expired or not found.
type Item ¶
type Item struct { Key string Value interface{} CreatedAt time.Time AccessedAt time.Time AbsoluteExpirationTime time.Time SlidingExpirationPeriod time.Duration Dependencies []dependency.Dependency }
Item represents a cache item.
func MustNewItem ¶
MustNewItem is like as NewItem but panic if key is empty.
func (*Item) HasExpired ¶
HasExpired reports whether the item has expired.
func (*Item) MarshalGob ¶
Marshal marshals the item to byte data by gob.
func (*Item) SetAbsoluteExpiration ¶
SetAbsoluteExpiration sets the Absolute expiration for item.
func (*Item) SetDependencies ¶
func (i *Item) SetDependencies(Dependencies ...dependency.Dependency)
SetDependencies sets the Dependencies for item.
func (*Item) SetSlidingExpiration ¶
SetSlidingExpiration sets the Sliding expiration for item.
func (*Item) UnmarshalGob ¶
Unmarshal unmarshals the item from byte data by gob.
Directories
¶
Path | Synopsis |
---|---|
concurrent
Package concurrent providers a cache container wrapper for safe concurrent access.
|
Package concurrent providers a cache container wrapper for safe concurrent access. |
memory
Package memory providers in-memory cache containers.
|
Package memory providers in-memory cache containers. |
memory/arc
Package arc providers an in-memory cache container using ARC (adaptive/adjustable replacement cache) arithmetic.
|
Package arc providers an in-memory cache container using ARC (adaptive/adjustable replacement cache) arithmetic. |
memory/fifo
Package fifo providers an in-memory cache container using FIFO (first in first out) arithmetic.
|
Package fifo providers an in-memory cache container using FIFO (first in first out) arithmetic. |
memory/lfu
Package lfu providers an in-memory cache container using LFU (least frequently used) arithmetic.
|
Package lfu providers an in-memory cache container using LFU (least frequently used) arithmetic. |
memory/lru
Package lru providers an in-memory cache Container using LRU (least recently used) arithmetic.
|
Package lru providers an in-memory cache Container using LRU (least recently used) arithmetic. |
memory/mru
Package mru providers an in-memory cache Container using MRU (most recently used) arithmetic.
|
Package mru providers an in-memory cache Container using MRU (most recently used) arithmetic. |
multilevel
Package multilevel providers a cache container wrapper for wrapping multi-level containers.
|
Package multilevel providers a cache container wrapper for wrapping multi-level containers. |
file
Package file providers a file caching dependency.
|
Package file providers a file caching dependency. |
Click to show internal directories.
Click to hide internal directories.