Documentation
¶
Index ¶
- Constants
- type BigcacheClientInterface
- type BigcacheStore
- type MemcacheClientInterface
- type MemcacheStore
- type MockBigcacheClientInterface
- type MockMemcacheClientInterface
- type MockRedisClientInterface
- type MockRistrettoClientInterface
- type Options
- type RedisClientInterface
- type RedisStore
- type RistrettoClientInterface
- type RistrettoStore
- type StoreInterface
Constants ¶
const (
BigcacheType = "bigcache"
)
const (
MemcacheType = "memcache"
)
const (
RedisType = "redis"
)
const (
RistrettoType = "ristretto"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BigcacheClientInterface ¶
type BigcacheClientInterface interface { Get(key string) ([]byte, error) Set(key string, entry []byte) error }
BigcacheClientInterface represents a allegro/bigcache client
type BigcacheStore ¶
type BigcacheStore struct {
// contains filtered or unexported fields
}
BigcacheStore is a store for Redis
func NewBigcache ¶
func NewBigcache(client BigcacheClientInterface, options *Options) *BigcacheStore
NewBigcache creates a new store to Bigcache instance(s)
func (*BigcacheStore) Get ¶
func (s *BigcacheStore) Get(key interface{}) (interface{}, error)
Get returns data stored from a given key
func (*BigcacheStore) GetType ¶
func (s *BigcacheStore) GetType() string
GetType returns the store type
func (*BigcacheStore) Set ¶
func (s *BigcacheStore) Set(key interface{}, value interface{}, options *Options) error
Set defines data in Redis for given key idntifier
type MemcacheClientInterface ¶
type MemcacheClientInterface interface { Get(key string) (item *memcache.Item, err error) Set(item *memcache.Item) error }
MemcacheClientInterface represents a bradfitz/gomemcache client
type MemcacheStore ¶
type MemcacheStore struct {
// contains filtered or unexported fields
}
MemcacheStore is a store for Redis
func NewMemcache ¶
func NewMemcache(client MemcacheClientInterface, options *Options) *MemcacheStore
NewMemcache creates a new store to Memcache instance(s)
func (*MemcacheStore) Get ¶
func (s *MemcacheStore) Get(key interface{}) (interface{}, error)
Get returns data stored from a given key
func (*MemcacheStore) GetType ¶
func (s *MemcacheStore) GetType() string
GetType returns the store type
func (*MemcacheStore) Set ¶
func (s *MemcacheStore) Set(key interface{}, value interface{}, options *Options) error
Set defines data in Redis for given key idntifier
type MockBigcacheClientInterface ¶
MockBigcacheClientInterface is an autogenerated mock type for the BigcacheClientInterface type
type MockMemcacheClientInterface ¶
MockMemcacheClientInterface is an autogenerated mock type for the MemcacheClientInterface type
type MockRedisClientInterface ¶
MockRedisClientInterface is an autogenerated mock type for the RedisClientInterface type
type MockRistrettoClientInterface ¶
MockRistrettoClientInterface is an autogenerated mock type for the RistrettoClientInterface type
func (*MockRistrettoClientInterface) Get ¶
func (_m *MockRistrettoClientInterface) Get(key interface{}) (interface{}, bool)
Get provides a mock function with given fields: key
func (*MockRistrettoClientInterface) Set ¶
func (_m *MockRistrettoClientInterface) Set(key interface{}, value interface{}, cost int64) bool
Set provides a mock function with given fields: key, value, cost
type Options ¶
type Options struct { // Cost corresponds to the memory capacity used by the item when setting a value // Actually it seems to be used by Ristretto library only Cost int64 // Expiration allows to specify an expiration time when setting a value Expiration time.Duration }
Options represents the cache store available options
func (Options) ExpirationValue ¶
ExpirationValue returns the expiration option value
type RedisClientInterface ¶
type RedisClientInterface interface { Get(key string) *redis.StringCmd Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd }
RedisClientInterface represents a go-redis/redis client
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore is a store for Redis
func NewRedis ¶
func NewRedis(client RedisClientInterface, options *Options) *RedisStore
NewRedis creates a new store to Redis instance(s)
func (*RedisStore) Get ¶
func (s *RedisStore) Get(key interface{}) (interface{}, error)
Get returns data stored from a given key
func (*RedisStore) Set ¶
func (s *RedisStore) Set(key interface{}, value interface{}, options *Options) error
Set defines data in Redis for given key idntifier
type RistrettoClientInterface ¶
type RistrettoClientInterface interface { Get(key interface{}) (interface{}, bool) Set(key, value interface{}, cost int64) bool }
RistrettoClientInterface represents a dgraph-io/ristretto client
type RistrettoStore ¶
type RistrettoStore struct {
// contains filtered or unexported fields
}
RistrettoStore is a store for Ristretto (memory) library
func NewRistretto ¶
func NewRistretto(client RistrettoClientInterface, options *Options) *RistrettoStore
NewRistretto creates a new store to Ristretto (memory) library instance
func (*RistrettoStore) Get ¶
func (s *RistrettoStore) Get(key interface{}) (interface{}, error)
Get returns data stored from a given key
func (*RistrettoStore) GetType ¶
func (s *RistrettoStore) GetType() string
GetType returns the store type
func (*RistrettoStore) Set ¶
func (s *RistrettoStore) Set(key interface{}, value interface{}, options *Options) error
Set defines data in Ristretto memoey cache for given key idntifier