Documentation
¶
Index ¶
- Variables
- type Config
- type DataStorage
- type Gcache
- func (g *Gcache) BatchDeleteKeys(ctx context.Context, keys []string) error
- func (g *Gcache) BatchGetValues(ctx context.Context, keys []string) ([]string, error)
- func (g *Gcache) BatchKeyExist(ctx context.Context, keys []string) (bool, error)
- func (g *Gcache) BatchSetKeys(ctx context.Context, kvs []util.Kv) error
- func (g *Gcache) CleanCache(ctx context.Context) error
- func (g *Gcache) DeleteKey(ctx context.Context, key string) error
- func (g *Gcache) DeleteKeysWithPrefix(ctx context.Context, keyPrefix string) error
- func (g *Gcache) GetValue(ctx context.Context, key string) (string, error)
- func (g *Gcache) Init(config *Config) error
- func (g *Gcache) KeyExists(ctx context.Context, key string) (bool, error)
- func (g *Gcache) SetKey(ctx context.Context, kv util.Kv) error
- type MemStoreConfig
- type Memory
- func (m *Memory) BatchDeleteKeys(ctx context.Context, keys []string) error
- func (m *Memory) BatchGetValues(ctx context.Context, keys []string) ([]string, error)
- func (m *Memory) BatchKeyExist(ctx context.Context, keys []string) (bool, error)
- func (m *Memory) BatchSetKeys(ctx context.Context, kvs []util.Kv) error
- func (m *Memory) CleanCache(ctx context.Context) error
- func (m *Memory) DeleteKey(ctx context.Context, key string) error
- func (m *Memory) DeleteKeysWithPrefix(ctx context.Context, keyPrefix string) error
- func (m *Memory) GetValue(ctx context.Context, key string) (string, error)
- func (m *Memory) Init(conf *Config) error
- func (m *Memory) KeyExists(ctx context.Context, key string) (bool, error)
- func (m *Memory) SetKey(ctx context.Context, kv util.Kv) error
- type Redis
- func (r *Redis) BatchDeleteKeys(ctx context.Context, keys []string) error
- func (r *Redis) BatchGetValues(ctx context.Context, keys []string) ([]string, error)
- func (r *Redis) BatchKeyExist(ctx context.Context, keys []string) (bool, error)
- func (r *Redis) BatchSetKeys(ctx context.Context, kvs []util.Kv) error
- func (r *Redis) CleanCache(ctx context.Context) error
- func (r *Redis) DeleteKey(ctx context.Context, key string) error
- func (r *Redis) DeleteKeysWithPrefix(ctx context.Context, keyPrefix string) error
- func (r *Redis) GetValue(ctx context.Context, key string) (data string, err error)
- func (r *Redis) Init(conf *Config) error
- func (r *Redis) KeyExists(ctx context.Context, key string) (bool, error)
- func (r *Redis) SetKey(ctx context.Context, kv util.Kv) error
- type RedisStoreConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultMemStoreConfig = &MemStoreConfig{
MaxSize: 1000,
}
View Source
var (
ErrCacheNotFound = errors.New("cache not found")
)
Functions ¶
This section is empty.
Types ¶
type DataStorage ¶
type DataStorage interface {
Init(config *Config) error
CleanCache(ctx context.Context) error
// read
BatchKeyExist(ctx context.Context, keys []string) (bool, error)
KeyExists(ctx context.Context, key string) (bool, error)
GetValue(ctx context.Context, key string) (string, error)
BatchGetValues(ctx context.Context, keys []string) ([]string, error)
// write
DeleteKeysWithPrefix(ctx context.Context, keyPrefix string) error
DeleteKey(ctx context.Context, key string) error
BatchDeleteKeys(ctx context.Context, keys []string) error
BatchSetKeys(ctx context.Context, kvs []util.Kv) error
SetKey(ctx context.Context, kv util.Kv) error
}
type Gcache ¶
func NewGcache ¶
func NewGcache(builder *gcache.CacheBuilder) *Gcache
func (*Gcache) BatchDeleteKeys ¶
func (*Gcache) BatchGetValues ¶
func (*Gcache) BatchKeyExist ¶
func (*Gcache) BatchSetKeys ¶
func (*Gcache) DeleteKeysWithPrefix ¶
type MemStoreConfig ¶
type MemStoreConfig struct {
MaxSize int64 // maximal items in primary cache
}
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
func NewMem ¶
func NewMem(config ...*MemStoreConfig) *Memory
func (*Memory) BatchDeleteKeys ¶
func (*Memory) BatchGetValues ¶
func (*Memory) BatchKeyExist ¶
func (*Memory) BatchSetKeys ¶
func (*Memory) DeleteKeysWithPrefix ¶
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
func NewRedis ¶ added in v1.2.0
func NewRedis(config ...*RedisStoreConfig) *Redis
func (*Redis) BatchDeleteKeys ¶
func (*Redis) BatchGetValues ¶
func (*Redis) BatchKeyExist ¶
func (*Redis) DeleteKeysWithPrefix ¶
Click to show internal directories.
Click to hide internal directories.