From 3cf045fd1b955aae66ebc4d0dd0b79b1d96deabc Mon Sep 17 00:00:00 2001 From: "Frederick F. Kautz IV" Date: Fri, 1 May 2015 22:01:02 -0700 Subject: [PATCH] Deleting key from lastAccessedObjects on eviction --- pkg/storage/drivers/memory/memory.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/storage/drivers/memory/memory.go b/pkg/storage/drivers/memory/memory.go index 6131c4184..7445319c8 100644 --- a/pkg/storage/drivers/memory/memory.go +++ b/pkg/storage/drivers/memory/memory.go @@ -498,6 +498,7 @@ func (memory *memoryDriver) doEvictObject(key lru.Key, value interface{}) { if len(storedBucket.objectMetadata) == 0 { delete(memory.storedBuckets, bucket) } + delete(memory.lastAccessedObjects, k) } } @@ -528,5 +529,7 @@ func (memory *memoryDriver) expireLRUObjects() { func (memory *memoryDriver) updateAccessTime(key string) { memory.lock.Lock() defer memory.lock.Unlock() - memory.lastAccessedObjects[key] = time.Now().UTC() + if _, ok := memory.lastAccessedObjects[key]; ok { + memory.lastAccessedObjects[key] = time.Now().UTC() + } }