Documentation
¶
Index ¶
- Variables
- func CheckError(err error)
- func ContainInArray(str string, arr []string) bool
- type Manager
- type Memcache
- func (m *Memcache) Add(key string, value []byte, expiration int32) bool
- func (m *Memcache) Conn() *memcache.Client
- func (m *Memcache) Decrement(key string, delta uint64) uint64
- func (m *Memcache) Delete(key string) error
- func (m *Memcache) Get(key string) []byte
- func (m *Memcache) GetMulti(keys []string) map[string][]byte
- func (m *Memcache) Increment(key string, delta uint64) uint64
- func (m *Memcache) Replace(key string, value []byte, expiration int32) error
- func (m *Memcache) Set(key string, value []byte, expiration int32) bool
- func (m *Memcache) Touch(key string, seconds int32) error
Constants ¶
This section is empty.
Variables ¶
var LostConnection = []string{
"reset by peer",
"connection refused",
}
Functions ¶
func CheckError ¶
func CheckError(err error)
func ContainInArray ¶
Types ¶
type Memcache ¶
type Memcache struct {
// contains filtered or unexported fields
}
func (*Memcache) Add ¶
Add writes the given item, if no value already exists for its key. ErrNotStored is returned if that condition is not met.
func (*Memcache) Decrement ¶
Decrement atomically decrements key by delta. The return value is the new value after being decremented or an error. If the value didn't exist in memcached the error is ErrCacheMiss. The value in memcached must be an decimal number, or an error will be returned. On underflow, the new value is capped at zero and does not wrap around.
func (*Memcache) Delete ¶
Delete deletes the item with the provided key. The error ErrCacheMiss is returned if the item didn't already exist in the cache.
func (*Memcache) Get ¶
Get gets the item for the given key. The key must be at most 250 bytes in length.
func (*Memcache) GetMulti ¶
GetMulti is a batch version of Get. The returned map from keys to items may have fewer elements than the input slice, due to memcache cache misses. Each key must be at most 250 bytes in length. If no error is returned, the returned map will also be non-nil.
func (*Memcache) Increment ¶
Increment atomically increments key by delta. The return value is the new value after being incremented or an error. If the value didn't exist in memcached the error is ErrCacheMiss. The value in memcached must be an decimal number, or an error will be returned. On 64-bit overflow, the new value wraps around.
func (*Memcache) Replace ¶
Replace writes the given item, but only if the server *does* already hold data for this key
func (*Memcache) Touch ¶
Touch updates the expiry for the given key. The seconds parameter is either a Unix timestamp or, if seconds is less than 1 month, the number of seconds into the future at which time the item will expire. Zero means the item has no expiration time. ErrCacheMiss is returned if the key is not in the cache. The key must be at most 250 bytes in length.