From 8f430150d69addaeb8904b302463355cc0e1d158 Mon Sep 17 00:00:00 2001 From: Patrick Mylund Nielsen Date: Mon, 2 Jan 2012 17:13:29 +0100 Subject: [PATCH] Expires bool is redundant with pointer to Time --- cache.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cache.go b/cache.go index 274ff64..7ce43bf 100644 --- a/cache.go +++ b/cache.go @@ -99,7 +99,6 @@ type cache struct { type Item struct { Object interface{} - Expires bool Expiration *time.Time } @@ -115,19 +114,15 @@ func (c *cache) Set(k string, x interface{}, d time.Duration) { defer c.mu.Unlock() var e *time.Time - expires := true if d == 0 { d = c.DefaultExpiration } - if d == -1 { - expires = false - } else { + if d > 0 { t := time.Now().Add(d) e = &t } c.Items[k] = &Item{ Object: x, - Expires: expires, Expiration: e, } }