cache.go
func (c *cache) DecrementFloat(k string, n float64) error {
	c.mu.Lock()
	v, found := c.items[k]
	if !found || v.Expired() {
		c.mu.Unlock()
		return fmt.Errorf("Item %s not found", k)
	}
	switch v.Object.(type) {
	case float32:
		v.Object = v.Object.(float32) - float32(n)
	case float64:
		v.Object = v.Object.(float64) - n
	default:
		c.mu.Unlock()
		return fmt.Errorf("The value for %s does not have type float32 or float64", k)
	}
	c.items[k] = v
	c.mu.Unlock()
	return nil
}
func (c *cache) DecrementFloat(k string, n float64) error {
	c.mu.Lock()
	v, found := c.items[k]
	if !found || v.Expired() {
		c.mu.Unlock()
		return fmt.Errorf("Item %s not found", k)
	}
	switch v.Object.(type) {
	case float32:
		v.Object = v.Object.(float32) - float32(n)
	case float64:
		v.Object = v.Object.(float64) - n
	default:
		c.mu.Unlock()
		return fmt.Errorf("The value for %s does not have type float32 or float64", k)
	}
	c.items[k] = v
	c.mu.Unlock()
	return nil
}
func ( c * cache ) DecrementFloat ( k string , n float64 ) error { c . mu . Lock ( ) v , found := c . items [ k ] if ! found || v . Expired ( ) { c . mu . Unlock ( ) return fmt . Errorf ( " " , k ) } switch v . Object . ( type ) { case float32 : v . Object = v . Object . ( float32 ) - float32 ( n ) case float64 : v . Object = v . Object . ( float64 ) - n default : c . mu . Unlock ( ) return fmt . Errorf ( " " , k ) } c . items [ k ] = v c . mu . Unlock ( ) return nil }
// Decrement 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 decrement it by n. Pass a negative number to decrement the
// value. To retrieve the decremented value, use one of the specialized methods,
// e.g. DecrementFloat64.
Decrement 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 decrement it by n . Pass a negative number to decrement the value . To retrieve the decremented value use one of the specialized methods e . g . DecrementFloat64 .