|
|
@ -49,6 +49,7 @@ type unexportedInterface interface {
|
|
|
|
DecrementFloat64(string, float64) (float64, error)
|
|
|
|
DecrementFloat64(string, float64) (float64, error)
|
|
|
|
Delete(string)
|
|
|
|
Delete(string)
|
|
|
|
DeleteExpired()
|
|
|
|
DeleteExpired()
|
|
|
|
|
|
|
|
ItemCount() int
|
|
|
|
Flush()
|
|
|
|
Flush()
|
|
|
|
Save(io.Writer) error
|
|
|
|
Save(io.Writer) error
|
|
|
|
SaveFile(string) error
|
|
|
|
SaveFile(string) error
|
|
|
@ -933,6 +934,15 @@ func (c *cache) LoadFile(fname string) error {
|
|
|
|
return fp.Close()
|
|
|
|
return fp.Close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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) ItemCount() int {
|
|
|
|
|
|
|
|
c.Lock()
|
|
|
|
|
|
|
|
n := len(c.items)
|
|
|
|
|
|
|
|
c.Unlock()
|
|
|
|
|
|
|
|
return n
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Delete all items from the cache.
|
|
|
|
// Delete all items from the cache.
|
|
|
|
func (c *cache) Flush() {
|
|
|
|
func (c *cache) Flush() {
|
|
|
|
c.Lock()
|
|
|
|
c.Lock()
|
|
|
|