diff --git a/README b/README index f6648cc..87c36a3 100644 --- a/README +++ b/README @@ -91,113 +91,4 @@ foo.Println(foo.Num) == Reference -func New(de, ci time.Duration) *Cache - Return a new cache with a given default expiration duration and cleanup - interval. If the expiration duration is less than 1, the items in the cache - never expire (by default), and must be deleted manually. If the cleanup - interval is less than one, expired items are not deleted from the cache - before their next lookup or before calling DeleteExpired. - -func (c *Cache) Set(k string, x interface{}, d time.Duration) - Add an item to the cache, replacing any existing item. If the duration is - 0, the cache's default expiration time is used. If it is -1, the item never - expires. - -func (c *Cache) Add(k string, x interface{}, d time.Duration) error - Add an item to the cache only if an item doesn't already exist for the - given key, or if the existing item has expired. Returns an error if not. - -func (c *Cache) Replace(k string, x interface{}, d time.Duration) error - Set a new value for the cache key only if it already exists. Returns an - error if it does not. - -func (c *Cache) Get(k string) (interface{}, bool) - Get an item from the cache. Returns the item or nil, and a bool indicating - whether the key was found. - -func (c *Cache) Increment(k string, n int64) error - Increment an item of type int, int8, int16, int32, int64, uintptr, uint, - uint8, uint32, or uint64, float32 or float64 by n. Returns an error if the - item's value is not an integer, if it was not found, or if it is not - possible to increment it by n. To retrieve the incremented value, use one - of the specialized methods, e.g. IncrementInt64. - -func (c *Cache) IncrementFloat(k string, n float64) error - Increment an item of type float32 or float64 by n. Returns an error if the - item's value is not floating point, if it was not found, or if it is not - possible to increment it by n. - -func (c *Cache) IncrementInt(k string, n int) (int, error) -func (c *Cache) IncrementInt8(k string, n int8) (int8, error) -func (c *Cache) IncrementInt16(k string, n int16) (int16, error) -func (c *Cache) IncrementInt32(k string, n int32) (int32, error) -func (c *Cache) IncrementInt64(k string, n int64) (int64, error) -func (c *Cache) IncrementUint(k string, n uint) (uint, error) -func (c *Cache) IncrementUint8(k string, n uint8) (uint8, error) -func (c *Cache) IncrementUint16(k string, n uint16) (uint16, error) -func (c *Cache) IncrementUint32(k string, n uint32) (uint32, error) -func (c *Cache) IncrementUint64(k string, n uint64) (uint64, error) -func (c *Cache) IncrementFloat32(k string, n float32) (float32, error) -func (c *Cache) IncrementFloat64(k string, n float64) (float64, error) - Increment an item of the specified type by n. Returns an error if the item's - value is not of that type, or if it was not found. If there is no error, the - incremented value is returned. - -func (c *Cache) Decrement(k string, n int64) error - Decrement an item of type int, int8, int16, int32, int64, uintptr, uint, - uint8, uint32, or uint64, float32 or float64 by n. Returns an error if the - item's value is not an integer, if it was not found, or if it is not - possible to decrement it by n. - -func (c *Cache) DecrementFloat(k string, n float64) error - Decrement an item of type float32 or float64 by n. Returns an error if the - item's value is floating point, if it was not found, or if it is not - possible to decrement it by n. - -func (c *Cache) DecrementInt(k string, n int) (int, error) -func (c *Cache) DecrementInt8(k string, n int8) (int8, error) -func (c *Cache) DecrementInt16(k string, n int16) (int16, error) -func (c *Cache) DecrementInt32(k string, n int32) (int32, error) -func (c *Cache) DecrementInt64(k string, n int64) (int64, error) -func (c *Cache) DecrementUint(k string, n uint) (uint, error) -func (c *Cache) DecrementUintptr(k string, n uintptr) (uintptr, error) -func (c *Cache) DecrementUint8(k string, n uint8) (uint8, error) -func (c *Cache) DecrementUint16(k string, n uint16) (uint16, error) -func (c *Cache) DecrementUint32(k string, n uint32) (uint32, error) -func (c *Cache) DecrementUint64(k string, n uint64) (uint64, error) -func (c *Cache) DecrementFloat32(k string, n float32) (float32, error) -func (c *Cache) DecrementFloat64(k string, n float64) (float64, error) - Decrement an item of the specified type by n. Returns an error if the item's - value is not of that type, or if it was not found. If there is no error, the - decremented value is returned. - -func (c *Cache) Delete(k string) - Delete an item from the cache. Does nothing if the key does not exist in the - cache. - -func (c *Cache) DeleteExpired() - Delete all expired items from the cache. - -func (c *Cache) ItemCount() - Returns the number of items in the cache. This may include items that have - expired, but have not yet been cleaned up. - -func (c *Cache) Flush() - Delete all items from the cache. - -func (c *Cache) Save(w io.Writer) error - Write the cache's items (using Gob) to an io.Writer. Returns an error if - the serialization fails, e.g. because there are unserializable objects like - channels in the cache. - -func (c *Cache) SaveFile(fname string) error - Save the cache's items to the given filename, creating the file if it - doesn't exist, and overwriting it if it does. - -func (c *Cache) Load(r io.Reader) error - Add (Gob-serialized) cache items from an io.Reader, excluding any items - with keys that already exist in the current cache. - -func (c *Cache) LoadFile(fname string) error - Loads and adds cache items from the given filename, excluding any items - with keys that already exist in the current cache. +http://godoc.org/github.com/pmylund/go-cache