Documentation ¶
Index ¶
- func Delete(ctx context.Context, key string) error
- func DeleteMulti(ctx context.Context, keys []string) error
- func Increment(ctx context.Context, key string, delta int64, initialValue uint64) (newValue uint64, err error)
- func IncrementExisting(ctx context.Context, key string, delta int64) (newValue uint64, err error)
- func IncrementOrSet(ctx context.Context, key string, delta int64, ...) (uint64, error)
- func Remember(ctx context.Context, key string, expiration time.Duration, p SlowRetrieve, ...) (interface{}, error)
- func Retrieve(ctx context.Context, key string, options ...CacheOptions) (string, error)
- func RetrieveGob(ctx context.Context, key string, options ...CacheOptions) (interface{}, error)
- func Store(ctx context.Context, key string, expiration time.Duration, val interface{}, ...) error
- func StoreGob(ctx context.Context, key string, expiration time.Duration, val interface{}, ...) error
- type CacheOptions
- type Key
- type SlowRetrieve
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IncrementExisting ¶
func IncrementOrSet ¶
func IncrementOrSet(ctx context.Context, key string, delta int64, iv func(ctx context.Context) (uint64, time.Duration, error), options ...CacheOptions) (uint64, error)
IncrementOrSet works like Increment but assumes that the key already exists in memcache. If the key doesn't exist in memcache, iv is used to set the initial value and delta is not applied. The value in the cache (after delta or set) is returned.
func Remember ¶
func Remember(ctx context.Context, key string, expiration time.Duration, p SlowRetrieve, options ...CacheOptions) (interface{}, error)
Remember is used to retrieve values from the cache, and if it doesn't exist, then retrieve them using p
func RetrieveGob ¶
func RetrieveGob(ctx context.Context, key string, options ...CacheOptions) (interface{}, error)
RetrieveGob will retrieve the value from the cache. Type assertion will need to be performed in order to use the value
Types ¶
type CacheOptions ¶
type Key ¶
type Key string
func CreateKey ¶
CreateKey will generate a key based on the input arguments. When prefix is true, the caller's name will be used to prefix the key in an attempt to make it unique. The args can also be separated using sep. visual does not do anything. It is used at code level to easily see how the key should look