Documentation
¶
Index ¶
Constants ¶
View Source
const ( TypeMem = "memory" TypeRedis = "redis" TypeFile = "file" MaxTimeOut = 365 * 24 * 3600 )
Variables ¶
This section is empty.
Functions ¶
func DecodeValue ¶
func EncodeValue ¶
Types ¶
type FileCache ¶
type FileCache struct { Dir string // contains filtered or unexported fields }
func NewFileCache ¶
func NewFileCache() *FileCache
type Handler ¶
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
func NewMemoryCache ¶
func NewMemoryCache(maxBytes int64) *MemoryCache
NewMemoryCache creates a new MemoryCache.default maxBytes is 0, means no limit.
func (*MemoryCache) Gc ¶
func (m *MemoryCache) Gc() error
func (*MemoryCache) Get ¶
func (m *MemoryCache) Get(key string, value interface{}) error
func (*MemoryCache) RemoveOldest ¶
func (m *MemoryCache) RemoveOldest()
type PriorityQueue ¶
type PriorityQueue []*CacheItem
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func NewRedis ¶
func NewRedis(conf *redis.Options) *RedisCache
func RedisCacheInit ¶
func RedisCacheInit(conf *redis.Options) *RedisCache
func (*RedisCache) Gc ¶
func (c *RedisCache) Gc() error
func (*RedisCache) Get ¶
func (c *RedisCache) Get(key string, value interface{}) error
type SimpleCache ¶
type SimpleCache struct {
// contains filtered or unexported fields
}
此处实现了一个简单的缓存,用于测试 SimpleCache is a simple cache implementation
func NewSimpleCache ¶
func NewSimpleCache() *SimpleCache
func (*SimpleCache) Gc ¶
func (s *SimpleCache) Gc() error
func (*SimpleCache) Get ¶
func (s *SimpleCache) Get(key string, value interface{}) error
Click to show internal directories.
Click to hide internal directories.