revised formatting

This commit is contained in:
Giuseppe 2015-12-05 14:53:44 +01:00
parent 3969366c62
commit 05f1124e1e
2 changed files with 3 additions and 12 deletions

View File

@ -11,7 +11,6 @@ import (
"time" "time"
) )
type Item struct { type Item struct {
Object interface{} Object interface{}
Expiration int64 Expiration int64
@ -26,7 +25,6 @@ func (node Node) Less(than llrb.Item) bool {
return node.Expiration < than.(Node).Expiration return node.Expiration < than.(Node).Expiration
} }
// Returns true if the item has expired. // Returns true if the item has expired.
func (item Item) Expired() bool { func (item Item) Expired() bool {
if item.Expiration == 0 { if item.Expiration == 0 {
@ -907,14 +905,11 @@ func (c *cache) delete(k string) (interface{}, bool) {
c.deleteFromBst(Node{Expiration: v.Expiration, Key: k}) c.deleteFromBst(Node{Expiration: v.Expiration, Key: k})
if c.onEvicted != nil { if c.onEvicted != nil {
return v.Object, true return v.Object, true
} else {
return nil, false
} }
} }
return nil, false return nil, false
} }
type keyAndValue struct { type keyAndValue struct {
key string key string
value interface{} value interface{}
@ -948,8 +943,6 @@ func (c *cache) DeleteExpired() {
} }
} }
// Sets an (optional) function that is called with the key and value when an // Sets an (optional) function that is called with the key and value when an
// item is evicted from the cache. (Including when it is deleted manually, but // item is evicted from the cache. (Including when it is deleted manually, but
// not when it is overwritten.) Set to nil to disable. // not when it is overwritten.) Set to nil to disable.
@ -1016,9 +1009,7 @@ func (c *cache) Load(r io.Reader) error {
if !found { if !found {
c.sortedItems.InsertNoReplace(Node{Expiration: v.Expiration, Key: k}) c.sortedItems.InsertNoReplace(Node{Expiration: v.Expiration, Key: k})
} }
} }
} }
} }
return err return err