Documentation
¶
Index ¶
- type CacheInterface
- type Options
- type RedisCache
- func (r *RedisCache) Forever(key string, value interface{}) error
- func (r *RedisCache) Get(key string) string
- func (r *RedisCache) GetInt(key string) (int, error)
- func (r *RedisCache) GetStruct(k string, data interface{}) error
- func (r *RedisCache) GetTtl(key string) time.Duration
- func (r *RedisCache) Remove(key string) int
- func (r *RedisCache) Set(key string, value interface{}, ttl time.Duration) error
- func (r *RedisCache) SetStruct(k string, d interface{}, ttl time.Duration) error
- func (r *RedisCache) SetTtl(key string, ttl time.Duration) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheInterface ¶
type CacheInterface interface { Set(key string, value interface{}, ttl time.Duration) error // 设置缓存 Get(key string) string // 获取缓存 string GetInt(key string) (int, error) // 获取int GetTtl(key string) time.Duration // 获取存活时间 SetTtl(key string, ttl time.Duration) bool // 强制修改缓存时间 Remove(key string) int // 删除缓存 Forever(key string, value interface{}) error // 永久缓存 SetStruct(key string, value interface{}, ttl time.Duration) error GetStruct(key string, dest interface{}) error }
func GetCache ¶
func GetCache(driver string, options ...*Options) CacheInterface
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func NewRedisCache ¶
func NewRedisCache(conf string) *RedisCache
func (*RedisCache) Forever ¶
func (r *RedisCache) Forever(key string, value interface{}) error
func (*RedisCache) Get ¶
func (r *RedisCache) Get(key string) string
func (*RedisCache) GetStruct ¶
func (r *RedisCache) GetStruct(k string, data interface{}) error
func (*RedisCache) Remove ¶
func (r *RedisCache) Remove(key string) int
func (*RedisCache) Set ¶
func (r *RedisCache) Set(key string, value interface{}, ttl time.Duration) error
Click to show internal directories.
Click to hide internal directories.