Keep the same tense in docstrings, and remove a little ambiguity
This commit is contained in:
@@ -92,28 +92,28 @@ foo.Println(foo.Num)
|
||||
== Reference
|
||||
|
||||
func New(de, ci time.Duration) *Cache
|
||||
Returns a new cache with a given default expiration duration and cleanup
|
||||
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)
|
||||
Adds an item to the cache, replacing any existing item. If the duration is
|
||||
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
|
||||
Adds an item to the cache only if an item doesn't already exist for the
|
||||
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
|
||||
Sets a new value for the cache item only if it already exists. Returns an
|
||||
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)
|
||||
Gets an item from the cache. Returns the item or nil, and a bool indicating
|
||||
whether the given key was found in the cache.
|
||||
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,
|
||||
@@ -136,28 +136,28 @@ func (c *Cache) Decrement(k string, n int64) error
|
||||
possible to decrement it by n.
|
||||
|
||||
func (c *Cache) Delete(k string)
|
||||
Deletes an item from the cache. Does nothing if the item does not exist in
|
||||
the cache.
|
||||
Delete an item from the cache. Does nothing if the key does not exist in the
|
||||
cache.
|
||||
|
||||
func (c *Cache) DeleteExpired()
|
||||
Deletes all expired items from the cache.
|
||||
Delete all expired items from the cache.
|
||||
|
||||
func (c *Cache) Flush()
|
||||
Deletes all items from the cache.
|
||||
Delete all items from the cache.
|
||||
|
||||
func (c *Cache) Save(w io.Writer) error
|
||||
Writes the cache's items (using Gob) to an io.Writer. Returns an error if
|
||||
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
|
||||
Saves the cache's items to the given filename, creating the file if it
|
||||
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
|
||||
Adds (Gob-serialized) cache items from an io.Reader, excluding any items
|
||||
that already exist in the current cache.
|
||||
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
|
||||
that already exist in the current cache.
|
||||
with keys that already exist in the current cache.
|
||||
|
||||
Reference in New Issue
Block a user