cache

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Set(key, val interface{}) error
	SetWithExpire(key, val interface{}, expire time.Duration) error
	Get(key interface{}) (interface{}, error)
	Remove(key interface{}) error
	Has(key interface{}) bool
	Len() int
	Cap() int
}

func NewLRUCache

func NewLRUCache(cap int) Cache

type Item

type Item interface {
	Key() interface{}
	Val() interface{}
	//Expire(exp time.Time)
	IsExpired() bool
	Fresh(key, val interface{}, expire *time.Time)
}

func NewItem

func NewItem(key, val interface{}, expire *time.Time) Item

type ItemAI

type ItemAI struct {
	// contains filtered or unexported fields
}

func (*ItemAI) Fresh

func (i *ItemAI) Fresh(key, val interface{}, expire *time.Time)

func (*ItemAI) IsExpired

func (i *ItemAI) IsExpired() bool

func (*ItemAI) Key

func (i *ItemAI) Key() interface{}

func (*ItemAI) SetExpired

func (i *ItemAI) SetExpired()

func (*ItemAI) Val

func (i *ItemAI) Val() interface{}

type LRUCache

type LRUCache struct {
	// contains filtered or unexported fields
}

func (*LRUCache) Cap

func (c *LRUCache) Cap() int

func (*LRUCache) Get

func (c *LRUCache) Get(key interface{}) (val interface{}, err error)

func (*LRUCache) Has

func (c *LRUCache) Has(key interface{}) bool

func (*LRUCache) Len

func (c *LRUCache) Len() int

func (*LRUCache) Remove

func (c *LRUCache) Remove(key interface{}) (err error)

func (*LRUCache) Set

func (c *LRUCache) Set(key, val interface{}) error

func (*LRUCache) SetWithExpire

func (c *LRUCache) SetWithExpire(key, val interface{}, expire time.Duration) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL