Documentation ¶
Index ¶
- Constants
- Variables
- type GoCacheClientInterface
- type GoCacheStore
- func (s *GoCacheStore) Clear() error
- func (s *GoCacheStore) Delete(key string) error
- func (s *GoCacheStore) Get(key string) (interface{}, error)
- func (g *GoCacheStore) GetType() string
- func (s *GoCacheStore) GetWithTTL(key string) (interface{}, time.Duration, error)
- func (s *GoCacheStore) Set(key string, value interface{}, expiration time.Duration) error
- func (s *GoCacheStore) SetNX(key string, value interface{}, expiration time.Duration) bool
- type Options
- type RedisClientInterface
- type RedisStore
- func (s *RedisStore) Clear() error
- func (s *RedisStore) Delete(key string) error
- func (s *RedisStore) Get(key string) (interface{}, error)
- func (s *RedisStore) GetType() string
- func (s *RedisStore) GetWithTTL(key string) (interface{}, time.Duration, error)
- func (s *RedisStore) Set(key string, val interface{}, expiration time.Duration) error
- func (s *RedisStore) SetNX(key string, value interface{}, expiration time.Duration) bool
- type StoreInterface
Constants ¶
View Source
const GoCacheType = "go-cache"
View Source
const RedisType = "redis"
Variables ¶
View Source
var (
ErrValueNotFound = errors.New("value not found")
)
Functions ¶
This section is empty.
Types ¶
type GoCacheClientInterface ¶
type GoCacheClientInterface interface { Get(k string) (interface{}, bool) GetWithExpiration(k string) (interface{}, time.Time, bool) Set(k string, x interface{}, d time.Duration) Delete(k string) Add(k string, x interface{}, d time.Duration) error Flush() }
GoCacheClientInterface represents a github.com/patrickmn/go-cache client
type GoCacheStore ¶
type GoCacheStore struct {
// contains filtered or unexported fields
}
func NewGoCache ¶
func NewGoCache(client GoCacheClientInterface, options *Options) *GoCacheStore
func (*GoCacheStore) Clear ¶
func (s *GoCacheStore) Clear() error
func (*GoCacheStore) Delete ¶
func (s *GoCacheStore) Delete(key string) error
func (*GoCacheStore) Get ¶
func (s *GoCacheStore) Get(key string) (interface{}, error)
func (*GoCacheStore) GetType ¶
func (g *GoCacheStore) GetType() string
func (*GoCacheStore) GetWithTTL ¶
func (s *GoCacheStore) GetWithTTL(key string) (interface{}, time.Duration, error)
type RedisClientInterface ¶
type RedisClientInterface interface { Get(key string) *redis.StringCmd TTL(key string) *redis.DurationCmd Set(key string, values interface{}, expiration time.Duration) *redis.StatusCmd Del(keys ...string) *redis.IntCmd FlushAll() *redis.StatusCmd SetNX(key string, value interface{}, expiration time.Duration) *redis.BoolCmd }
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
func NewRedis ¶
func NewRedis(client RedisClientInterface, options *Options) *RedisStore
func (*RedisStore) Clear ¶
func (s *RedisStore) Clear() error
func (*RedisStore) Delete ¶
func (s *RedisStore) Delete(key string) error
func (*RedisStore) Get ¶
func (s *RedisStore) Get(key string) (interface{}, error)
func (*RedisStore) GetType ¶
func (s *RedisStore) GetType() string
func (*RedisStore) GetWithTTL ¶
func (s *RedisStore) GetWithTTL(key string) (interface{}, time.Duration, error)
type StoreInterface ¶
type StoreInterface interface { Get(key string) (interface{}, error) GetWithTTL(key string) (interface{}, time.Duration, error) Set(key string, value interface{}, expiration time.Duration) error Delete(key string) error Clear() error GetType() string SetNX(key string, value interface{}, expiration time.Duration) bool }
Click to show internal directories.
Click to hide internal directories.