This commit is contained in:
Durand 2019-10-07 02:38:34 +00:00 committed by GitHub
commit 7356a5e1cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -128,6 +128,7 @@ func (c *cache) Get(k string) (interface{}, bool) {
if item.Expiration > 0 {
if time.Now().UnixNano() > item.Expiration {
c.mu.RUnlock()
c.Delete(k)
return nil, false
}
}
@ -151,6 +152,7 @@ func (c *cache) GetWithExpiration(k string) (interface{}, time.Time, bool) {
if item.Expiration > 0 {
if time.Now().UnixNano() > item.Expiration {
c.mu.RUnlock()
c.Delete(k)
return nil, time.Time{}, false
}