Documentation ¶
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
}
Cache represents a cache.
func (*Cache) Get ¶
Get returns the value of caching item. it returns nil if caching item has expired.
func (Cache) Set ¶
func (this Cache) Set(key string, value interface{}, expiration *Expiration, dependencies ...Dependency) error
Set sets the caching item.
type Container ¶
type Container interface { // Get returns the value by given key. Get(key string) (interface{}, error) // Set inserts/updates the item. Set(key string, value interface{}) error // Remove removes the item by given key. Remove(key string) error // Clear removes all items. Clear() error }
Container represents a container.
type Dependency ¶
type Dependency interface {
HasChanged() bool
}
Dependency represents an external expiration dependency.
type Expiration ¶
Expiration represents an expiration about time.
func NewExpiration ¶
func NewExpiration(absoluteTime time.Time, slidingPeriod time.Duration) *Expiration
NewExpiration returns a new instance of Expiration.
type Item ¶
type Item struct { Key string Value interface{} CreatedTime time.Time LastAccessedTime time.Time Expiration *Expiration Dependencies []Dependency }
Item represents an item.
func NewItem ¶
func NewItem(key string, value interface{}, expiration *Expiration, dependencies ...Dependency) *Item
NewItem returns a new instance of Item.
func (Item) HasExpired ¶
HasExpired reports whether the item has expired.
Click to show internal directories.
Click to hide internal directories.