Documentation ¶
Index ¶
- func Delete(key string) error
- func Deletes(keys []string, prefix string) error
- func Get(key string) (interface{}, bool)
- func GetSettings(keys []string, prefix string) (map[string]string, []string)
- func Init()
- func Set(key string, value interface{}, ttl int) error
- func SetSettings(values map[string]string, prefix string) error
- type Driver
- type MemoryStore
- func (store *MemoryStore) Delete(key string) error
- func (store *MemoryStore) Deletes(keys []string, prefix string) error
- func (store *MemoryStore) GarbageCollect()
- func (store *MemoryStore) Get(key string) (interface{}, bool)
- func (store *MemoryStore) Gets(keys []string, prefix string) (map[string]interface{}, []string)
- func (store *MemoryStore) Set(key string, value interface{}, ttl int) error
- func (store *MemoryStore) Sets(values map[string]interface{}, prefix string) error
- type RedisStore
- func (store *RedisStore) Delete(key string) error
- func (store *RedisStore) DeleteAll() error
- func (store *RedisStore) Deletes(keys []string, prefix string) error
- func (store *RedisStore) Get(key string) (interface{}, bool)
- func (store *RedisStore) Gets(keys []string, prefix string) (map[string]interface{}, []string)
- func (store *RedisStore) Set(key string, value interface{}, ttl int) error
- func (store *RedisStore) Sets(values map[string]interface{}, prefix string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSettings ¶
GetSettings 根据名称批量获取设置项缓存
Types ¶
type Driver ¶
type Driver interface { // Set 设置值,ttl为过期时间,单位为秒 Set(key string, value interface{}, ttl int) error // Get 取值,并返回是否成功 Get(key string) (interface{}, bool) // Gets 批量取值,返回成功取值的map即不存在的值 Gets(keys []string, prefix string) (map[string]interface{}, []string) // Sets 批量设置值,所有的key都会加上prefix前缀 Sets(values map[string]interface{}, prefix string) error // Delete 删除值 Delete(key string) error // Deletes 批量删除值,所有的key都会加上prefix前缀 Deletes(keys []string, prefix string) error }
Driver 键值缓存存储容器
type MemoryStore ¶
MemoryStore 内存存储驱动
func (*MemoryStore) Deletes ¶
func (store *MemoryStore) Deletes(keys []string, prefix string) error
Deletes 批量删除值
func (*MemoryStore) GarbageCollect ¶
func (store *MemoryStore) GarbageCollect()
GarbageCollect 回收已过期的缓存
func (*MemoryStore) Gets ¶
func (store *MemoryStore) Gets(keys []string, prefix string) (map[string]interface{}, []string)
Gets 批量取值
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore redis存储驱动
func NewRedisStore ¶
func NewRedisStore(size int, network, address, password string, database int) *RedisStore
NewRedisStore 创建新的redis存储
func (*RedisStore) Deletes ¶
func (store *RedisStore) Deletes(keys []string, prefix string) error
Deletes 批量删除给定的键
func (*RedisStore) Gets ¶
func (store *RedisStore) Gets(keys []string, prefix string) (map[string]interface{}, []string)
Gets 批量取值
Click to show internal directories.
Click to hide internal directories.