Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultCacheService string
DefaultCacheService decides the default cache service connection.
Functions ¶
Types ¶
type CacheService ¶
type CacheService interface {
// Get returns cached data for given keys.
Get(keys ...string) (results []Result, err error)
// Gets returns cached data for given keys, it is an alternative Get api
// for using with CAS. Gets returns a CAS identifier with the item. If
// the item's CAS value has changed since you Gets'ed it, it will not be stored.
Gets(keys ...string) (results []Result, err error)
// Set set the value with specified cache key.
Set(key string, flags uint16, timeout uint64, value []byte) (stored bool, err error)
// Add store the value only if it does not already exist.
Add(key string, flags uint16, timeout uint64, value []byte) (stored bool, err error)
// Replace replaces the value, only if the value already exists,
// for the specified cache key.
Replace(key string, flags uint16, timeout uint64, value []byte) (stored bool, err error)
// Append appends the value after the last bytes in an existing item.
Append(key string, flags uint16, timeout uint64, value []byte) (stored bool, err error)
// Prepend prepends the value before existing value.
Prepend(key string, flags uint16, timeout uint64, value []byte) (stored bool, err error)
// Cas stores the value only if no one else has updated the data since you read it last.
Cas(key string, flags uint16, timeout uint64, value []byte, cas uint64) (stored bool, err error)
// Delete delete the value for the specified cache key.
Delete(key string) (deleted bool, err error)
// FlushAll purges the entire cache.
FlushAll() (err error)
// Stats returns a list of basic stats.
Stats(argument string) (result []byte, err error)
// Close closes the CacheService
Close()
}
CacheService defines functions to use a cache service.
func Connect ¶
func Connect(config Config) (CacheService, error)
Connect returns a CacheService using the given config.
type NewConnFunc ¶
type NewConnFunc func(config Config) (CacheService, error)
NewConnFunc is a factory method that creates a CacheService instance using given CacheServiceConfig.
Click to show internal directories.
Click to hide internal directories.