Documentation
¶
Index ¶
- Constants
- func Register(name string, store Store)
- func Version() string
- type AdapterConfig
- type Cache
- func (this *Cache) Client() interface{}
- func (this *Cache) Decr(key string) int64
- func (this *Cache) Delete(key string)
- func (this *Cache) DeleteByPrefix(prefix string)
- func (this *Cache) Flush()
- func (this *Cache) Get(key string) string
- func (this *Cache) Incr(key string) int64
- func (this *Cache) IsExist(key string) bool
- func (this *Cache) Key(key string) string
- func (this *Cache) Set(key, val string, expiration time.Duration)
- func (this *Cache) Touch(key string)
- type MemoryCache
- func (r *MemoryCache) Client() interface{}
- func (c *MemoryCache) Decr(key string) int64
- func (c *MemoryCache) Del(keys ...string) int64
- func (c *MemoryCache) Delete(key string)
- func (c *MemoryCache) DeleteByPrefix(prefix string)
- func (c *MemoryCache) Exists(keys ...string) int64
- func (c *MemoryCache) Expire(key string, expiration time.Duration) bool
- func (c *MemoryCache) Flush()
- func (c *MemoryCache) Forever(key, val string) error
- func (c *MemoryCache) Get(key string) string
- func (c *MemoryCache) HDel(key string, fields ...string) int64
- func (c *MemoryCache) HExists(key, field string) bool
- func (c *MemoryCache) HGet(key, field string) string
- func (c *MemoryCache) HGetAll(key string) map[string]string
- func (c *MemoryCache) HMGet(key string, fields ...string) []interface{}
- func (c *MemoryCache) HMSet(key string, values ...interface{}) bool
- func (c *MemoryCache) HSet(key string, values ...interface{}) int64
- func (c *MemoryCache) HSetNX(key, field string, value interface{}) bool
- func (c *MemoryCache) Incr(key string) int64
- func (c *MemoryCache) IsExist(key string) bool
- func (r *MemoryCache) Key(key string) string
- func (c *MemoryCache) LLen(key string) int64
- func (c *MemoryCache) LPush(key string, values ...interface{}) int64
- func (c *MemoryCache) LRange(key string, start, stop int64) []string
- func (c *MemoryCache) SAdd(key string, members ...interface{}) int64
- func (c *MemoryCache) SCard(key string) int64
- func (c *MemoryCache) SRem(key string, members ...interface{}) int64
- func (c *MemoryCache) SScan(key string, cursor uint64, match string, count int64) ([]string, uint64)
- func (c *MemoryCache) Set(key, val string, expiration time.Duration)
- func (c *MemoryCache) SetEX(key string, value interface{}, expiration time.Duration) string
- func (c *MemoryCache) SetNX(key string, value interface{}, expiration time.Duration) bool
- func (c *MemoryCache) TTL(key string) time.Duration
- func (c *MemoryCache) Touch(key string)
- func (c *MemoryCache) Type(key string) string
- func (c *MemoryCache) ZAdd(key string, members ...*redis.Z) int64
- func (c *MemoryCache) ZRange(key string, start, stop int64) []string
- func (c *MemoryCache) ZRank(key, member string) int64
- func (c *MemoryCache) ZRem(key string, members ...interface{}) int64
- func (c *MemoryCache) ZScore(key, member string) float64
- type MemoryItem
- type Options
- type RedisCache
- func (r *RedisCache) Client() interface{}
- func (r *RedisCache) Decr(key string) int64
- func (r *RedisCache) Del(keys ...string) int64
- func (r *RedisCache) Delete(key string)
- func (r *RedisCache) DeleteByPrefix(prefix string)
- func (r *RedisCache) Exists(keys ...string) int64
- func (r *RedisCache) Expire(key string, expiration time.Duration) bool
- func (r *RedisCache) Flush()
- func (r *RedisCache) Get(key string) string
- func (r *RedisCache) HDel(key string, fields ...string) int64
- func (r *RedisCache) HExists(key, field string) bool
- func (r *RedisCache) HGet(key, field string) string
- func (r *RedisCache) HGetAll(key string) map[string]string
- func (r *RedisCache) HMGet(key string, fields ...string) []interface{}
- func (r *RedisCache) HMSet(key string, values ...interface{}) bool
- func (r *RedisCache) HSet(key string, values ...interface{}) int64
- func (r *RedisCache) HSetNX(key, field string, value interface{}) bool
- func (r *RedisCache) Incr(key string) int64
- func (r *RedisCache) IsExist(key string) bool
- func (r *RedisCache) Key(key string) string
- func (r *RedisCache) LLen(key string) int64
- func (r *RedisCache) LPush(key string, values ...interface{}) int64
- func (r *RedisCache) LRange(key string, start, stop int64) []string
- func (r *RedisCache) SAdd(key string, members ...interface{}) int64
- func (r *RedisCache) SCard(key string) int64
- func (r *RedisCache) SRem(key string, members ...interface{}) int64
- func (r *RedisCache) SScan(key string, cursor uint64, match string, count int64) ([]string, uint64)
- func (r *RedisCache) Set(key, val string, expiration time.Duration)
- func (r *RedisCache) SetEX(key string, value interface{}, expiration time.Duration) string
- func (r *RedisCache) SetNX(key string, value interface{}, expiration time.Duration) bool
- func (r *RedisCache) TTL(key string) time.Duration
- func (r *RedisCache) Touch(key string)
- func (r *RedisCache) Type(key string) string
- func (r *RedisCache) ZAdd(key string, members ...*redis.Z) int64
- func (r *RedisCache) ZRange(key string, start, stop int64) []string
- func (r *RedisCache) ZRank(key, member string) int64
- func (r *RedisCache) ZRem(key string, members ...interface{}) int64
- func (r *RedisCache) ZScore(key, member string) float64
- type Store
Constants ¶
View Source
const VersionName = "0.1.0"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AdapterConfig ¶
type Cache ¶
type Cache struct {
Opt Options
// contains filtered or unexported fields
}
func (*Cache) DeleteByPrefix ¶
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache represents a memory cache adapter implementation.
func NewMemoryCache ¶
func NewMemoryCache() *MemoryCache
NewMemoryCache creates and returns a new memory cache.
func (*MemoryCache) Client ¶ added in v0.5.0
func (r *MemoryCache) Client() interface{}
func (*MemoryCache) Decr ¶
func (c *MemoryCache) Decr(key string) int64
func (*MemoryCache) Del ¶ added in v1.0.5
func (c *MemoryCache) Del(keys ...string) int64
func (*MemoryCache) Delete ¶
func (c *MemoryCache) Delete(key string)
func (*MemoryCache) DeleteByPrefix ¶
func (c *MemoryCache) DeleteByPrefix(prefix string)
DeleteByPrefix Delete deletes cached value by given prefix.
func (*MemoryCache) Exists ¶ added in v1.0.5
func (c *MemoryCache) Exists(keys ...string) int64
func (*MemoryCache) Expire ¶ added in v1.0.5
func (c *MemoryCache) Expire(key string, expiration time.Duration) bool
func (*MemoryCache) Flush ¶
func (c *MemoryCache) Flush()
func (*MemoryCache) Forever ¶
func (c *MemoryCache) Forever(key, val string) error
Forever put value into cache with key forever save
func (*MemoryCache) Get ¶
func (c *MemoryCache) Get(key string) string
func (*MemoryCache) HDel ¶ added in v1.0.5
func (c *MemoryCache) HDel(key string, fields ...string) int64
func (*MemoryCache) HExists ¶ added in v1.0.5
func (c *MemoryCache) HExists(key, field string) bool
func (*MemoryCache) HGet ¶ added in v1.0.5
func (c *MemoryCache) HGet(key, field string) string
func (*MemoryCache) HGetAll ¶ added in v1.0.5
func (c *MemoryCache) HGetAll(key string) map[string]string
func (*MemoryCache) HMGet ¶ added in v1.0.5
func (c *MemoryCache) HMGet(key string, fields ...string) []interface{}
func (*MemoryCache) HMSet ¶ added in v1.0.5
func (c *MemoryCache) HMSet(key string, values ...interface{}) bool
func (*MemoryCache) HSet ¶ added in v1.0.5
func (c *MemoryCache) HSet(key string, values ...interface{}) int64
func (*MemoryCache) HSetNX ¶ added in v1.0.5
func (c *MemoryCache) HSetNX(key, field string, value interface{}) bool
func (*MemoryCache) Incr ¶
func (c *MemoryCache) Incr(key string) int64
Incr increases cached int-type value by given key as a counter.
func (*MemoryCache) IsExist ¶
func (c *MemoryCache) IsExist(key string) bool
func (*MemoryCache) Key ¶ added in v0.5.2
func (r *MemoryCache) Key(key string) string
func (*MemoryCache) LLen ¶ added in v1.0.5
func (c *MemoryCache) LLen(key string) int64
func (*MemoryCache) LPush ¶ added in v1.0.5
func (c *MemoryCache) LPush(key string, values ...interface{}) int64
func (*MemoryCache) LRange ¶ added in v1.0.5
func (c *MemoryCache) LRange(key string, start, stop int64) []string
func (*MemoryCache) SAdd ¶ added in v1.0.5
func (c *MemoryCache) SAdd(key string, members ...interface{}) int64
func (*MemoryCache) SCard ¶ added in v1.0.5
func (c *MemoryCache) SCard(key string) int64
func (*MemoryCache) SRem ¶ added in v1.0.5
func (c *MemoryCache) SRem(key string, members ...interface{}) int64
func (*MemoryCache) SetEX ¶ added in v1.0.5
func (c *MemoryCache) SetEX(key string, value interface{}, expiration time.Duration) string
func (*MemoryCache) SetNX ¶ added in v1.0.5
func (c *MemoryCache) SetNX(key string, value interface{}, expiration time.Duration) bool
func (*MemoryCache) Touch ¶
func (c *MemoryCache) Touch(key string)
func (*MemoryCache) Type ¶ added in v1.0.5
func (c *MemoryCache) Type(key string) string
func (*MemoryCache) ZAdd ¶ added in v1.0.5
func (c *MemoryCache) ZAdd(key string, members ...*redis.Z) int64
func (*MemoryCache) ZRange ¶ added in v1.0.5
func (c *MemoryCache) ZRange(key string, start, stop int64) []string
func (*MemoryCache) ZRank ¶ added in v1.0.5
func (c *MemoryCache) ZRank(key, member string) int64
func (*MemoryCache) ZRem ¶ added in v1.0.5
func (c *MemoryCache) ZRem(key string, members ...interface{}) int64
func (*MemoryCache) ZScore ¶ added in v1.0.5
func (c *MemoryCache) ZScore(key, member string) float64
type MemoryItem ¶
type MemoryItem struct {
// contains filtered or unexported fields
}
MemoryItem represents a memory cache item.
type Options ¶
type Options struct {
// alias
Alias string
// Name of adapter. Default is "redis".
Adapter string
// Adapter configuration, it's corresponding to adapter.
AdapterConfig AdapterConfig
// key prefix Default is ""
Section string
}
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func NewRedisCache ¶
func NewRedisCache() *RedisCache
NewRedisCache creates and returns a new redis cache.
func (*RedisCache) Client ¶ added in v0.5.0
func (r *RedisCache) Client() interface{}
func (*RedisCache) Decr ¶
func (r *RedisCache) Decr(key string) int64
func (*RedisCache) Del ¶ added in v1.0.5
func (r *RedisCache) Del(keys ...string) int64
func (*RedisCache) Delete ¶
func (r *RedisCache) Delete(key string)
func (*RedisCache) DeleteByPrefix ¶
func (r *RedisCache) DeleteByPrefix(prefix string)
DeleteByPrefix Delete deletes cached value by given prefix key.
func (*RedisCache) Exists ¶ added in v1.0.5
func (r *RedisCache) Exists(keys ...string) int64
func (*RedisCache) Expire ¶ added in v1.0.5
func (r *RedisCache) Expire(key string, expiration time.Duration) bool
func (*RedisCache) Flush ¶
func (r *RedisCache) Flush()
func (*RedisCache) Get ¶
func (r *RedisCache) Get(key string) string
func (*RedisCache) HDel ¶ added in v1.0.5
func (r *RedisCache) HDel(key string, fields ...string) int64
func (*RedisCache) HExists ¶ added in v1.0.5
func (r *RedisCache) HExists(key, field string) bool
func (*RedisCache) HGet ¶ added in v1.0.5
func (r *RedisCache) HGet(key, field string) string
func (*RedisCache) HGetAll ¶ added in v1.0.5
func (r *RedisCache) HGetAll(key string) map[string]string
func (*RedisCache) HMGet ¶ added in v1.0.5
func (r *RedisCache) HMGet(key string, fields ...string) []interface{}
func (*RedisCache) HMSet ¶ added in v1.0.5
func (r *RedisCache) HMSet(key string, values ...interface{}) bool
func (*RedisCache) HSet ¶ added in v1.0.5
func (r *RedisCache) HSet(key string, values ...interface{}) int64
func (*RedisCache) HSetNX ¶ added in v1.0.5
func (r *RedisCache) HSetNX(key, field string, value interface{}) bool
func (*RedisCache) Incr ¶
func (r *RedisCache) Incr(key string) int64
func (*RedisCache) IsExist ¶
func (r *RedisCache) IsExist(key string) bool
func (*RedisCache) Key ¶ added in v0.5.2
func (r *RedisCache) Key(key string) string
func (*RedisCache) LLen ¶ added in v1.0.5
func (r *RedisCache) LLen(key string) int64
func (*RedisCache) LPush ¶ added in v1.0.5
func (r *RedisCache) LPush(key string, values ...interface{}) int64
func (*RedisCache) LRange ¶ added in v1.0.5
func (r *RedisCache) LRange(key string, start, stop int64) []string
func (*RedisCache) SAdd ¶ added in v1.0.5
func (r *RedisCache) SAdd(key string, members ...interface{}) int64
func (*RedisCache) SCard ¶ added in v1.0.5
func (r *RedisCache) SCard(key string) int64
func (*RedisCache) SRem ¶ added in v1.0.5
func (r *RedisCache) SRem(key string, members ...interface{}) int64
func (*RedisCache) SetEX ¶ added in v1.0.5
func (r *RedisCache) SetEX(key string, value interface{}, expiration time.Duration) string
func (*RedisCache) SetNX ¶ added in v1.0.5
func (r *RedisCache) SetNX(key string, value interface{}, expiration time.Duration) bool
func (*RedisCache) Touch ¶
func (r *RedisCache) Touch(key string)
func (*RedisCache) Type ¶ added in v1.0.5
func (r *RedisCache) Type(key string) string
func (*RedisCache) ZAdd ¶ added in v1.0.5
func (r *RedisCache) ZAdd(key string, members ...*redis.Z) int64
func (*RedisCache) ZRange ¶ added in v1.0.5
func (r *RedisCache) ZRange(key string, start, stop int64) []string
func (*RedisCache) ZRank ¶ added in v1.0.5
func (r *RedisCache) ZRank(key, member string) int64
func (*RedisCache) ZRem ¶ added in v1.0.5
func (r *RedisCache) ZRem(key string, members ...interface{}) int64
func (*RedisCache) ZScore ¶ added in v1.0.5
func (r *RedisCache) ZScore(key, member string) float64
type Store ¶
type Store interface {
Client() interface{}
Key(key string) string
Set(key, val string, expiration time.Duration)
Get(key string) string
HGet(key, field string) string
HGetAll(key string) map[string]string
HSet(key string, values ...interface{}) int64
HExists(key, field string) bool
HMGet(key string, fields ...string) []interface{}
HMSet(key string, values ...interface{}) bool
SCard(key string) int64
SAdd(key string, members ...interface{}) int64
SRem(key string, members ...interface{}) int64
LRange(key string, start, stop int64) []string
LPush(key string, values ...interface{}) int64
LLen(key string) int64
ZAdd(key string, members ...*redis.Z) int64
ZRange(key string, start, stop int64) []string
ZRank(key, member string) int64
ZScore(key, member string) float64
ZRem(key string, members ...interface{}) int64
SetEX(key string, value interface{}, expiration time.Duration) string
SetNX(key string, value interface{}, expiration time.Duration) bool
HSetNX(key, field string, value interface{}) bool
SScan(key string, cursor uint64, match string, count int64) ([]string, uint64)
Del(keys ...string) int64
Delete(key string)
DeleteByPrefix(prefix string)
HDel(key string, fields ...string) int64
Incr(key string) int64
Decr(key string) int64
Type(key string) string
TTL(key string) time.Duration
Expire(key string, expiration time.Duration) bool
Exists(keys ...string) int64
IsExist(key string) bool
Touch(key string)
Flush()
// contains filtered or unexported methods
}
Store Cache is the interface that operates the cache data.
Click to show internal directories.
Click to hide internal directories.