Documentation ¶
Index ¶
- type LRUCache
- func (lru *LRUCache) Get(ctx context.Context, key string, valuePtr interface{}) (found bool, err error)
- func (lru *LRUCache) MGet(ctx context.Context, keys []string, destSlicePtr interface{}) (missIndexes []int, err error)
- func (lru *LRUCache) MSet(ctx context.Context, keys []string, destSlice interface{}, ttl time.Duration) error
- func (lru *LRUCache) Set(ctx context.Context, key string, value interface{}, TTL time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache 进程内的LRU缓存。只存储最近使用的。 基于github.com/wencan/xsync/LRUMap,按批次(区块)清理最近不用的数据。 实现了github.com/wencan/fastrest/restcache的Storage接口和MStorage接口。
func NewLRUCache ¶
NewLRUCache 创建lru缓存。chunkCapacity、chunkNum是github.com/wencan/xsync/LRUMap的区块参数。
func (*LRUCache) Get ¶
func (lru *LRUCache) Get(ctx context.Context, key string, valuePtr interface{}) (found bool, err error)
Get 实现github.com/wencan/fastrest/restcache的Storage接口。
func (*LRUCache) MGet ¶
func (lru *LRUCache) MGet(ctx context.Context, keys []string, destSlicePtr interface{}) (missIndexes []int, err error)
MGet 实现github.com/wencan/fastrest/restcache的MStorage接口。
Click to show internal directories.
Click to hide internal directories.