Documentation ¶
Index ¶
- Constants
- func Register(name string, store Store)
- func Version() string
- type AdapterConfig
- type Cache
- func (this *Cache) Client() interface{}
- func (this *Cache) Close() error
- func (this *Cache) Decr(key string) (int64, error)
- func (this *Cache) Del(keys ...string) (int64, error)
- func (this *Cache) Delete(key string) error
- func (this *Cache) DeleteByPrefix(prefix string) error
- func (this *Cache) Exist(key string) bool
- func (this *Cache) Exists(keys ...string) (int64, error)
- func (this *Cache) Expire(key string, expiration time.Duration) (bool, error)
- func (this *Cache) Flush() error
- func (this *Cache) Get(key string) (string, error)
- func (this *Cache) HDel(key string, fields ...string) (int64, error)
- func (this *Cache) HExists(key, field string) (bool, error)
- func (this *Cache) HGet(key, field string) (string, error)
- func (this *Cache) HGetAll(key string) (map[string]string, error)
- func (this *Cache) HMGet(key string, fields ...string) ([]interface{}, error)
- func (this *Cache) HMSet(key string, values ...interface{}) (bool, error)
- func (this *Cache) HSet(key string, values ...interface{}) (int64, error)
- func (this *Cache) Incr(key string) (int64, error)
- func (this *Cache) Key(key string) string
- func (this *Cache) LLen(key string) (int64, error)
- func (this *Cache) LPush(key string, values ...interface{}) (int64, error)
- func (this *Cache) LRange(key string, start, stop int64) ([]string, error)
- func (this *Cache) RPop(key string) (string, error)
- func (this *Cache) RPopCount(key string, count int) ([]string, error)
- func (this *Cache) RPopLPush(source, destination string) (string, error)
- func (this *Cache) RPush(key string, values ...interface{}) (int64, error)
- func (this *Cache) RPushX(key string, values ...interface{}) (int64, error)
- func (this *Cache) SAdd(key string, members ...interface{}) (int64, error)
- func (this *Cache) SCard(key string) (int64, error)
- func (this *Cache) SRem(key string, members ...interface{}) (int64, error)
- func (this *Cache) Set(key, val string, expiration time.Duration) error
- func (this *Cache) TTL(key string) (time.Duration, error)
- func (this *Cache) Touch(key string) error
- func (this *Cache) Type(key string) (string, error)
- type MemoryCache
- func (r *MemoryCache) Client() interface{}
- func (c *MemoryCache) Close() error
- func (c *MemoryCache) Decr(key string) (int64, error)
- func (c *MemoryCache) Del(keys ...string) (int64, error)
- func (c *MemoryCache) Delete(key string) error
- func (c *MemoryCache) DeleteByPrefix(prefix string) error
- func (c *MemoryCache) Exist(key string) bool
- func (c *MemoryCache) Exists(keys ...string) (int64, error)
- func (c *MemoryCache) Expire(key string, expiration time.Duration) (bool, error)
- func (c *MemoryCache) Flush() error
- func (c *MemoryCache) Forever(key, val string) error
- func (c *MemoryCache) Get(key string) (string, error)
- func (c *MemoryCache) HDel(key string, fields ...string) (int64, error)
- func (c *MemoryCache) HExists(key, field string) (bool, error)
- func (c *MemoryCache) HGet(key, field string) (string, error)
- func (c *MemoryCache) HGetAll(key string) (map[string]string, error)
- func (c *MemoryCache) HMGet(key string, fields ...string) ([]interface{}, error)
- func (c *MemoryCache) HMSet(key string, values ...interface{}) (bool, error)
- func (c *MemoryCache) HSet(key string, values ...interface{}) (int64, error)
- func (c *MemoryCache) Incr(key string) (int64, error)
- func (r *MemoryCache) Key(key string) string
- func (c *MemoryCache) LLen(key string) (int64, error)
- func (c *MemoryCache) LPush(key string, values ...interface{}) (int64, error)
- func (c *MemoryCache) LRange(key string, start, stop int64) ([]string, error)
- func (c *MemoryCache) RPop(key string) (string, error)
- func (c *MemoryCache) RPopCount(key string, count int) ([]string, error)
- func (c *MemoryCache) RPopLPush(source, destination string) (string, error)
- func (c *MemoryCache) RPush(key string, values ...interface{}) (int64, error)
- func (c *MemoryCache) RPushX(key string, values ...interface{}) (int64, error)
- func (c *MemoryCache) SAdd(key string, members ...interface{}) (int64, error)
- func (c *MemoryCache) SCard(key string) (int64, error)
- func (c *MemoryCache) SRem(key string, members ...interface{}) (int64, error)
- func (c *MemoryCache) Set(key, val string, expiration time.Duration) error
- func (c *MemoryCache) TTL(key string) (time.Duration, error)
- func (c *MemoryCache) Touch(key string) error
- func (c *MemoryCache) Type(key string) (string, error)
- type MemoryItem
- type Options
- type RedisCache
- func (r *RedisCache) Client() interface{}
- func (r *RedisCache) Close() error
- func (r *RedisCache) Decr(key string) (int64, error)
- func (r *RedisCache) Del(keys ...string) (int64, error)
- func (r *RedisCache) Delete(key string) error
- func (r *RedisCache) DeleteByPrefix(prefix string) error
- func (r *RedisCache) Exist(key string) bool
- func (r *RedisCache) Exists(keys ...string) (int64, error)
- func (r *RedisCache) Expire(key string, expiration time.Duration) (bool, error)
- func (r *RedisCache) Flush() error
- func (r *RedisCache) Get(key string) (string, error)
- func (r *RedisCache) HDel(key string, fields ...string) (int64, error)
- func (r *RedisCache) HExists(key, field string) (bool, error)
- func (r *RedisCache) HGet(key, field string) (string, error)
- func (r *RedisCache) HGetAll(key string) (map[string]string, error)
- func (r *RedisCache) HMGet(key string, fields ...string) ([]interface{}, error)
- func (r *RedisCache) HMSet(key string, values ...interface{}) (bool, error)
- func (r *RedisCache) HSet(key string, values ...interface{}) (int64, error)
- func (r *RedisCache) Incr(key string) (int64, error)
- func (r *RedisCache) Key(key string) string
- func (r *RedisCache) LLen(key string) (int64, error)
- func (r *RedisCache) LPush(key string, values ...interface{}) (int64, error)
- func (r *RedisCache) LRange(key string, start, stop int64) ([]string, error)
- func (r *RedisCache) RPop(key string) (string, error)
- func (r *RedisCache) RPopCount(key string, count int) ([]string, error)
- func (r *RedisCache) RPopLPush(source, destination string) (string, error)
- func (r *RedisCache) RPush(key string, values ...interface{}) (int64, error)
- func (r *RedisCache) RPushX(key string, values ...interface{}) (int64, error)
- func (r *RedisCache) SAdd(key string, members ...interface{}) (int64, error)
- func (r *RedisCache) SCard(key string) (int64, error)
- func (r *RedisCache) SRem(key string, members ...interface{}) (int64, error)
- func (r *RedisCache) Set(key, val string, expiration time.Duration) error
- func (r *RedisCache) TTL(key string) (time.Duration, error)
- func (r *RedisCache) Touch(key string) error
- func (r *RedisCache) Type(key string) (string, error)
- type Store
Constants ¶
View Source
const VersionName = "0.1.0"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AdapterConfig ¶
type AdapterConfig struct { Addr string Password string DB int // Maximum number of socket connections. // Default is 10 connections per every available CPU as reported by runtime.GOMAXPROCS. PoolSize int // Minimum number of idle connections which is useful when establishing // new connection is slow. MinIdleConns int }
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) Close ¶ added in v1.2.1
func (c *MemoryCache) Close() error
func (*MemoryCache) Delete ¶
func (c *MemoryCache) Delete(key string) error
func (*MemoryCache) DeleteByPrefix ¶
func (c *MemoryCache) DeleteByPrefix(prefix string) error
func (*MemoryCache) Exist ¶ added in v1.0.6
func (c *MemoryCache) Exist(key string) bool
func (*MemoryCache) Exists ¶ added in v1.0.5
func (c *MemoryCache) Exists(keys ...string) (int64, error)
func (*MemoryCache) Flush ¶
func (c *MemoryCache) Flush() error
func (*MemoryCache) Forever ¶
func (c *MemoryCache) Forever(key, val string) error
Forever put value into cache with key forever save
func (*MemoryCache) HDel ¶ added in v1.0.5
func (c *MemoryCache) HDel(key string, fields ...string) (int64, error)
func (*MemoryCache) HExists ¶ added in v1.0.5
func (c *MemoryCache) HExists(key, field string) (bool, error)
func (*MemoryCache) HGet ¶ added in v1.0.5
func (c *MemoryCache) HGet(key, field string) (string, error)
func (*MemoryCache) HGetAll ¶ added in v1.0.5
func (c *MemoryCache) HGetAll(key string) (map[string]string, error)
func (*MemoryCache) HMGet ¶ added in v1.0.5
func (c *MemoryCache) HMGet(key string, fields ...string) ([]interface{}, error)
func (*MemoryCache) HMSet ¶ added in v1.0.5
func (c *MemoryCache) HMSet(key string, values ...interface{}) (bool, error)
func (*MemoryCache) HSet ¶ added in v1.0.5
func (c *MemoryCache) HSet(key string, values ...interface{}) (int64, error)
func (*MemoryCache) Key ¶ added in v0.5.2
func (r *MemoryCache) Key(key string) string
func (*MemoryCache) LPush ¶ added in v1.0.5
func (c *MemoryCache) LPush(key string, values ...interface{}) (int64, error)
func (*MemoryCache) LRange ¶ added in v1.0.5
func (c *MemoryCache) LRange(key string, start, stop int64) ([]string, error)
func (*MemoryCache) RPopCount ¶ added in v1.0.7
func (c *MemoryCache) RPopCount(key string, count int) ([]string, error)
func (*MemoryCache) RPopLPush ¶ added in v1.0.7
func (c *MemoryCache) RPopLPush(source, destination string) (string, error)
func (*MemoryCache) RPush ¶ added in v1.0.7
func (c *MemoryCache) RPush(key string, values ...interface{}) (int64, error)
func (*MemoryCache) RPushX ¶ added in v1.0.7
func (c *MemoryCache) RPushX(key string, values ...interface{}) (int64, error)
func (*MemoryCache) SAdd ¶ added in v1.0.5
func (c *MemoryCache) SAdd(key string, members ...interface{}) (int64, error)
func (*MemoryCache) SRem ¶ added in v1.0.5
func (c *MemoryCache) SRem(key string, members ...interface{}) (int64, error)
func (*MemoryCache) Set ¶
func (c *MemoryCache) Set(key, val string, expiration time.Duration) error
func (*MemoryCache) TTL ¶ added in v1.0.5
func (c *MemoryCache) TTL(key string) (time.Duration, error)
func (*MemoryCache) Touch ¶
func (c *MemoryCache) Touch(key string) error
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) Close ¶ added in v1.2.1
func (r *RedisCache) Close() error
func (*RedisCache) Delete ¶
func (r *RedisCache) Delete(key string) error
func (*RedisCache) DeleteByPrefix ¶
func (r *RedisCache) DeleteByPrefix(prefix string) error
DeleteByPrefix Delete deletes cached value by given prefix key.
func (*RedisCache) Exist ¶ added in v1.0.6
func (r *RedisCache) Exist(key string) bool
func (*RedisCache) Exists ¶ added in v1.0.5
func (r *RedisCache) Exists(keys ...string) (int64, error)
func (*RedisCache) Flush ¶
func (r *RedisCache) Flush() error
func (*RedisCache) HDel ¶ added in v1.0.5
func (r *RedisCache) HDel(key string, fields ...string) (int64, error)
func (*RedisCache) HExists ¶ added in v1.0.5
func (r *RedisCache) HExists(key, field string) (bool, error)
func (*RedisCache) HGet ¶ added in v1.0.5
func (r *RedisCache) HGet(key, field string) (string, error)
func (*RedisCache) HGetAll ¶ added in v1.0.5
func (r *RedisCache) HGetAll(key string) (map[string]string, error)
func (*RedisCache) HMGet ¶ added in v1.0.5
func (r *RedisCache) HMGet(key string, fields ...string) ([]interface{}, error)
func (*RedisCache) HMSet ¶ added in v1.0.5
func (r *RedisCache) HMSet(key string, values ...interface{}) (bool, error)
func (*RedisCache) HSet ¶ added in v1.0.5
func (r *RedisCache) HSet(key string, values ...interface{}) (int64, error)
func (*RedisCache) Key ¶ added in v0.5.2
func (r *RedisCache) Key(key string) string
func (*RedisCache) LPush ¶ added in v1.0.5
func (r *RedisCache) LPush(key string, values ...interface{}) (int64, error)
func (*RedisCache) LRange ¶ added in v1.0.5
func (r *RedisCache) LRange(key string, start, stop int64) ([]string, error)
func (*RedisCache) RPopCount ¶ added in v1.0.7
func (r *RedisCache) RPopCount(key string, count int) ([]string, error)
func (*RedisCache) RPopLPush ¶ added in v1.0.7
func (r *RedisCache) RPopLPush(source, destination string) (string, error)
func (*RedisCache) RPush ¶ added in v1.0.7
func (r *RedisCache) RPush(key string, values ...interface{}) (int64, error)
func (*RedisCache) RPushX ¶ added in v1.0.7
func (r *RedisCache) RPushX(key string, values ...interface{}) (int64, error)
func (*RedisCache) SAdd ¶ added in v1.0.5
func (r *RedisCache) SAdd(key string, members ...interface{}) (int64, error)
func (*RedisCache) SRem ¶ added in v1.0.5
func (r *RedisCache) SRem(key string, members ...interface{}) (int64, error)
func (*RedisCache) TTL ¶ added in v1.0.5
func (r *RedisCache) TTL(key string) (time.Duration, error)
func (*RedisCache) Touch ¶
func (r *RedisCache) Touch(key string) error
type Store ¶
type Store interface { Client() interface{} Close() error Key(key string) string Set(key, val string, expiration time.Duration) error Get(key string) (string, error) HGet(key, field string) (string, error) HGetAll(key string) (map[string]string, error) HSet(key string, values ...interface{}) (int64, error) HExists(key, field string) (bool, error) HMSet(key string, values ...interface{}) (bool, error) HMGet(key string, fields ...string) ([]interface{}, error) SCard(key string) (int64, error) SAdd(key string, members ...interface{}) (int64, error) SRem(key string, members ...interface{}) (int64, error) LRange(key string, start, stop int64) ([]string, error) LPush(key string, values ...interface{}) (int64, error) LLen(key string) (int64, error) RPop(key string) (string, error) RPopCount(key string, count int) ([]string, error) RPopLPush(source, destination string) (string, error) RPush(key string, values ...interface{}) (int64, error) RPushX(key string, values ...interface{}) (int64, error) Del(keys ...string) (int64, error) Delete(key string) error DeleteByPrefix(prefix string) error HDel(key string, fields ...string) (int64, error) Incr(key string) (int64, error) Decr(key string) (int64, error) Type(key string) (string, error) TTL(key string) (time.Duration, error) Expire(key string, expiration time.Duration) (bool, error) Exists(keys ...string) (int64, error) Exist(key string) bool Touch(key string) error Flush() error // 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.