Documentation ¶
Index ¶
- Variables
- func Bool(reply interface{}) (bool, error)
- func Bytes(reply interface{}) ([]byte, error)
- func Float64(reply interface{}) (float64, error)
- func Int(reply interface{}) (int, error)
- func Int64(reply interface{}) (int64, error)
- func MultiBulk(reply interface{}) ([]interface{}, error)
- func String(reply interface{}) (string, error)
- func Strings(reply interface{}) ([]string, error)
- func Uint64(reply interface{}) (uint64, error)
- func Values(reply interface{}) ([]interface{}, error)
- type CacheKVStore
- type CacheKVStoreConnection
- func (c *CacheKVStoreConnection) Append(key string, value interface{}) error
- func (c *CacheKVStoreConnection) Close() error
- func (c *CacheKVStoreConnection) Delete(key string) error
- func (c *CacheKVStoreConnection) Exists(key string) bool
- func (c *CacheKVStoreConnection) Flush() error
- func (c *CacheKVStoreConnection) Get(key string) interface{}
- func (c *CacheKVStoreConnection) Len() int
- func (c *CacheKVStoreConnection) RemoveOldest() (key string, value interface{})
- func (c *CacheKVStoreConnection) Set(key string, value interface{}) error
- type Error
- type KVStore
- type KVStoreConnection
- type RedisKVStore
- type RedisKVStoreConnection
- func (k *RedisKVStoreConnection) Append(key string, value interface{}) error
- func (k *RedisKVStoreConnection) Close() error
- func (k *RedisKVStoreConnection) Delete(key string) error
- func (k *RedisKVStoreConnection) Exists(key string) bool
- func (k *RedisKVStoreConnection) Flush() error
- func (k *RedisKVStoreConnection) Get(key string) interface{}
- func (k *RedisKVStoreConnection) Set(key string, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
var ErrNil = errors.New("redigo: nil returned")
Functions ¶
func Bool ¶
Bool is a helper that converts a command reply to a boolean. If err is not equal to nil, then Bool returns false, err. Otherwise Bool converts the reply to boolean as follows:
Reply type Result integer value != 0, nil bulk string strconv.ParseBool(reply) nil false, ErrNil other false, error
func Bytes ¶
Bytes is a helper that converts a command reply to a slice of bytes. If err is not equal to nil, then Bytes returns nil, err. Otherwise Bytes converts the reply to a slice of bytes as follows:
Reply type Result bulk string reply, nil simple string []byte(reply), nil nil nil, ErrNil other nil, error
func Float64 ¶
Float64 is a helper that converts a command reply to 64 bit float. If err is not equal to nil, then Float64 returns 0, err. Otherwise, Float64 converts the reply to an int as follows:
Reply type Result bulk string parsed reply, nil nil 0, ErrNil other 0, error
func Int ¶
Int is a helper that converts a command reply to an integer. If err is not equal to nil, then Int returns 0, err. Otherwise, Int converts the reply to an int as follows:
Reply type Result integer int(reply), nil bulk string parsed reply, nil nil 0, ErrNil other 0, error
func Int64 ¶
Int64 is a helper that converts a command reply to 64 bit integer. If err is not equal to nil, then Int returns 0, err. Otherwise, Int64 converts the reply to an int64 as follows:
Reply type Result integer reply, nil bulk string parsed reply, nil nil 0, ErrNil other 0, error
func MultiBulk ¶
func MultiBulk(reply interface{}) ([]interface{}, error)
MultiBulk is deprecated. Use Values.
func String ¶
String is a helper that converts a command reply to a string. If err is not equal to nil, then String returns "", err. Otherwise String converts the reply to a string as follows:
Reply type Result bulk string string(reply), nil simple string reply, nil nil "", ErrNil other "", error
func Strings ¶
Strings is a helper that converts an array command reply to a []string. If err is not equal to nil, then Strings returns nil, err. If one of the array items is not a bulk string or nil, then Strings returns an error.
func Uint64 ¶
Uint64 is a helper that converts a command reply to 64 bit integer. If err is not equal to nil, then Int returns 0, err. Otherwise, Int64 converts the reply to an int64 as follows:
Reply type Result integer reply, nil bulk string parsed reply, nil nil 0, ErrNil other 0, error
func Values ¶
func Values(reply interface{}) ([]interface{}, error)
Values is a helper that converts an array command reply to a []interface{}. If err is not equal to nil, then Values returns nil, err. Otherwise, Values converts the reply as follows:
Reply type Result array reply, nil nil nil, ErrNil other nil, error
Types ¶
type CacheKVStore ¶
type CacheKVStore struct {
Cache *CacheKVStoreConnection
}
func (*CacheKVStore) Close ¶
func (c *CacheKVStore) Close() error
func (*CacheKVStore) Connection ¶
func (c *CacheKVStore) Connection() KVStoreConnection
type CacheKVStoreConnection ¶
type CacheKVStoreConnection struct {
// contains filtered or unexported fields
}
Cache is an LRU cache, safe for concurrent access.
func NewCacheKVStoreConnection ¶
func NewCacheKVStoreConnection(maxEntries int) *CacheKVStoreConnection
New returns a new cache with the provided maximum items.
func (*CacheKVStoreConnection) Append ¶
func (c *CacheKVStoreConnection) Append(key string, value interface{}) error
Appends the value to the existing item which is stored under provided key evicting an old item if necessary.
func (*CacheKVStoreConnection) Close ¶
func (c *CacheKVStoreConnection) Close() error
func (*CacheKVStoreConnection) Delete ¶
func (c *CacheKVStoreConnection) Delete(key string) error
func (*CacheKVStoreConnection) Exists ¶
func (c *CacheKVStoreConnection) Exists(key string) bool
func (*CacheKVStoreConnection) Flush ¶
func (c *CacheKVStoreConnection) Flush() error
func (*CacheKVStoreConnection) Get ¶
func (c *CacheKVStoreConnection) Get(key string) interface{}
Get fetches the key's value from the cache. The ok result will be true if the item was found.
func (*CacheKVStoreConnection) Len ¶
func (c *CacheKVStoreConnection) Len() int
Len returns the number of items in the cache.
func (*CacheKVStoreConnection) RemoveOldest ¶
func (c *CacheKVStoreConnection) RemoveOldest() (key string, value interface{})
RemoveOldest removes the oldest item in the cache and returns its key and value. If the cache is empty, the empty string and nil are returned.
func (*CacheKVStoreConnection) Set ¶
func (c *CacheKVStoreConnection) Set(key string, value interface{}) error
Add adds the provided key and value to the cache, evicting an old item if necessary.
type KVStore ¶
type KVStore interface { Connection() KVStoreConnection Close() error }
func NewCacheKVStore ¶
type KVStoreConnection ¶
type RedisKVStore ¶
func (*RedisKVStore) Close ¶
func (k *RedisKVStore) Close() error
func (*RedisKVStore) Connection ¶
func (k *RedisKVStore) Connection() KVStoreConnection
type RedisKVStoreConnection ¶
func (*RedisKVStoreConnection) Append ¶
func (k *RedisKVStoreConnection) Append(key string, value interface{}) error
func (*RedisKVStoreConnection) Close ¶
func (k *RedisKVStoreConnection) Close() error
func (*RedisKVStoreConnection) Delete ¶
func (k *RedisKVStoreConnection) Delete(key string) error
func (*RedisKVStoreConnection) Exists ¶
func (k *RedisKVStoreConnection) Exists(key string) bool
func (*RedisKVStoreConnection) Flush ¶
func (k *RedisKVStoreConnection) Flush() error
func (*RedisKVStoreConnection) Get ¶
func (k *RedisKVStoreConnection) Get(key string) interface{}
func (*RedisKVStoreConnection) Set ¶
func (k *RedisKVStoreConnection) Set(key string, value interface{}) error