gofmt and redundant 'if it was enabled'

master
Patrick Mylund Nielsen 13 years ago
parent ac5b195364
commit ca7e0d4f78

@ -235,7 +235,6 @@ func (c *cache) Decrement(k string, n int64) error {
return c.Increment(k, n*-1)
}
// Deletes an item from the cache. Does nothing if the item does not exist in the cache.
func (c *cache) Delete(k string) {
c.mu.Lock()
@ -272,7 +271,6 @@ func (i *Item) Expired() bool {
return i.Expiration.Before(time.Now())
}
func (j *janitor) Run(c *cache) {
j.stop = make(chan bool)
tick := time.Tick(j.Interval)
@ -316,9 +314,9 @@ func New(de, ci time.Duration) *Cache {
go j.Run(c)
}
// This trick ensures that the janitor goroutine (which--granted it was enabled--is
// running DeleteExpired on c forever, if it was enabled) does not keep the returned C
// object from being garbage collected. When it is garbage collected, the finalizer stops
// the janitor goroutine, after which c is collected.
// running DeleteExpired on c forever) does not keep the returned C object from being
// garbage collected. When it is garbage collected, the finalizer stops the janitor
// goroutine, after which c is collected.
C := &Cache{c}
if ci > 0 {
runtime.SetFinalizer(C, stopJanitor)

Loading…
Cancel
Save