Documentation
¶
Index ¶
- Variables
- func InitCache()
- type CacheInterface
- type MemoryCache
- func (m *MemoryCache) Bind(key string, bean interface{}) error
- func (m *MemoryCache) Del(key string) error
- func (m *MemoryCache) DelAll() error
- func (m *MemoryCache) Exists(key string) bool
- func (m *MemoryCache) Get(key string) ([]byte, error)
- func (m *MemoryCache) GetInt64(key string) (i int64, err error)
- func (m *MemoryCache) GetValue(key string) (string, error)
- func (m *MemoryCache) Remember(key string, set func() error) (b []byte, err error)
- func (m *MemoryCache) RememberBind(key string, bean interface{}, set func() error) error
- func (m *MemoryCache) Set(key string, value interface{}, exp time.Duration) error
- type RedisCache
- func (r *RedisCache) Bind(key string, bean interface{}) error
- func (r *RedisCache) Del(key string) error
- func (r *RedisCache) DelAll() error
- func (r *RedisCache) Exists(key string) bool
- func (r *RedisCache) Get(key string) (b []byte, err error)
- func (r *RedisCache) GetInt64(key string) (int64, error)
- func (r *RedisCache) GetValue(key string) (string, error)
- func (r *RedisCache) JSONSet(key string, value interface{}, exp time.Duration) error
- func (r *RedisCache) Remember(key string, set func() error) (b []byte, err error)
- func (r *RedisCache) RememberBind(key string, bean interface{}, set func() error) error
- func (r *RedisCache) Set(key string, value interface{}, exp time.Duration) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefCache CacheInterface RedisGlobalCache *RedisCache MeCache *MemoryCache )
DefCache ...
Functions ¶
Types ¶
type CacheInterface ¶
type CacheInterface interface { Get(key string) ([]byte, error) //if cannot get value,return 0 GetInt64(key string) (int64, error) //return "" if can't get value GetValue(key string) (string, error) //bind value to struct point Bind(key string, bean interface{}) error Set(key string, value interface{}, exp time.Duration) error Remember(key string, set func() error) ([]byte, error) RememberBind(key string, bean interface{}, set func() error) error Exists(key string) bool Del(key string) error DelAll() error }
CacheInterface ... 缓存接口
type MemoryCache ¶
MemoryCache ...
func (*MemoryCache) GetInt64 ¶
func (m *MemoryCache) GetInt64(key string) (i int64, err error)
GetInt64 ...
func (*MemoryCache) GetValue ¶
func (m *MemoryCache) GetValue(key string) (string, error)
GetValue ...
func (*MemoryCache) Remember ¶
func (m *MemoryCache) Remember(key string, set func() error) (b []byte, err error)
Remember ...
func (*MemoryCache) RememberBind ¶
func (m *MemoryCache) RememberBind(key string, bean interface{}, set func() error) error
RememberBind ...
type RedisCache ¶
RedisCache ...
func (*RedisCache) GetValue ¶
func (r *RedisCache) GetValue(key string) (string, error)
GetValue ...
func (*RedisCache) JSONSet ¶
func (r *RedisCache) JSONSet(key string, value interface{}, exp time.Duration) error
JSONSet ... 将一个对象序列化成 json 字符串,并进行存储
func (*RedisCache) Remember ¶
func (r *RedisCache) Remember(key string, set func() error) (b []byte, err error)
Remember ...
func (*RedisCache) RememberBind ¶
func (r *RedisCache) RememberBind(key string, bean interface{}, set func() error) error
RememberBind ...
Click to show internal directories.
Click to hide internal directories.