Skip to content

Commit e5a4606

Browse files
committed
update cache class to return nil when .Get() is called for an expured iten
1 parent 48f480e commit e5a4606

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/cache/cache.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ func (c *Cache) Get(key string) (*CacheEntry, bool) {
169169
return nil
170170
})
171171

172-
// if result.IsExpired() {
173-
// return nil, false
174-
// }
172+
if result.IsExpired() {
173+
return nil, false
174+
}
175175

176-
// result.DecodeValue()
176+
result.DecodeValue()
177177

178178
return result, true
179179
}
@@ -248,7 +248,7 @@ func (c *Cache) Set(key string, value *CacheEntry, ttlMinutes int) {
248248
// given key and checks if the value is not empty (`c.Get(key) != ""`) and if the cache entry is not
249249
// expired (`!c.IsExpired(key)`). If both conditions are true, it returns `true`, indicating that the
250250
// cache entry exists and is valid. Otherwise, it returns `false`.
251-
func (c Cache) Has(key string) bool {
251+
func (c *Cache) Has(key string) bool {
252252
found := false
253253

254254
c.Db.View(func(tx *bolt.Tx) error {

0 commit comments

Comments
 (0)