Documentation ¶
Index ¶
- Variables
- func CAS(c TransactionContext, key string, expected, replacement interface{}) (success bool, err error)
- func Del(c TransactionContext, keys ...string) (err error)
- func Get(c TransactionContext, key string, val interface{}) (found bool, err error)
- func Incr(c TransactionContext, key string, delta int64, initial uint64) (newValue uint64, err error)
- func IncrExisting(c TransactionContext, key string, delta int64) (newValue uint64, err error)
- func Keyify(k string) (result string, err error)
- func Memoize(c TransactionContext, key string, destP interface{}, ...) (err error)
- func Memoize2(c TransactionContext, super, key string, destP interface{}, ...) (err error)
- func MemoizeDuring(c TransactionContext, key string, duration time.Duration, cacheNil bool, ...) (err error)
- func MemoizeDuringSmart(c TransactionContext, key string, cacheNil bool, destP interface{}, ...) (err error)
- func MemoizeMulti(c TransactionContext, keys []string, destinationPointers []interface{}, ...) (errors appengine.MultiError)
- func Put(c TransactionContext, key string, val interface{}) (err error)
- func PutUntil(c TransactionContext, until time.Duration, key string, val interface{}) (err error)
- type TransactionContext
Constants ¶
This section is empty.
Variables ¶
var Codec = memcache.Gob
var ErrCacheMiss = memcache.ErrCacheMiss
var MemcacheEnabled = true
Functions ¶
func CAS ¶
func CAS(c TransactionContext, key string, expected, replacement interface{}) (success bool, err error)
CAS will replace expected with replacement in memcache if expected is the current value.
func Del ¶
func Del(c TransactionContext, keys ...string) (err error)
Del will delete the keys from memcache.
If c is InTransaction it will put the actual deletion inside c.AfterTransaction, otherwise the deletion will execute immediately.
func Get ¶
func Get(c TransactionContext, key string, val interface{}) (found bool, err error)
Get will lookup key and load it into val.
If c is in a transaction no lookup will take place.
func IncrExisting ¶
func IncrExisting(c TransactionContext, key string, delta int64) (newValue uint64, err error)
func Memoize ¶
func Memoize(c TransactionContext, key string, destP interface{}, f func() (interface{}, error)) (err error)
Memoize will lookup key and load it into destinatinoPointer. A missing value will be generated by the generatorFunction and saved in memcache.
func Memoize2 ¶
func Memoize2(c TransactionContext, super, key string, destP interface{}, f func() (interface{}, error)) (err error)
Memoize will lookup super and generate a new key from its contents and key. If super is missing a new random value will be inserted there.
It will then lookup that key and load it into destinatinoPointer. A missing value will be generated by the generatorFunction and saved in memcache.
It returns whether the value was nil (either from memcache or from the generatorFunction).
Deleting super will invalidate all keys under it due to the composite keys being impossible to regenerate again.
func MemoizeDuring ¶
func MemoizeDuring(c TransactionContext, key string, duration time.Duration, cacheNil bool, destP interface{}, f func() (interface{}, error)) (err error)
MemoizeDuring will lookup key and load it into destinatinoPointer. A missing value will be generated by the generatorFunction and saved in memcache with a timeout of duration.
func MemoizeDuringSmart ¶
func MemoizeDuringSmart(c TransactionContext, key string, cacheNil bool, destP interface{}, f func() (interface{}, time.Duration, error)) (err error)
MemoizeDuringSmart will lookup key and load it into destinatinoPointer. A missing value will be generated by the generatorFunction and saved in memcache with a timeout of duration.
func MemoizeMulti ¶
func MemoizeMulti(c TransactionContext, keys []string, destinationPointers []interface{}, generatorFunctions []func() (interface{}, error)) (errors appengine.MultiError)
MemoizeMulti will look for all provided keys, and load them into the destinationPointers.
Any missing values will be generated using the generatorFunctions and put in memcache without a timeout.
func Put ¶
func Put(c TransactionContext, key string, val interface{}) (err error)
Put will put val under key.