mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 17:41:57 +08:00
Fix: missing ttl check in memstore.Get
This commit is contained in:
4
pkg/cache/memo.go
vendored
4
pkg/cache/memo.go
vendored
@@ -35,7 +35,7 @@ func getValue(item interface{}, ok bool) (interface{}, bool) {
|
||||
|
||||
var itemObj itemWithTTL
|
||||
if itemObj, ok = item.(itemWithTTL); !ok {
|
||||
return nil, false
|
||||
return item, true
|
||||
}
|
||||
|
||||
if itemObj.expires > 0 && itemObj.expires < time.Now().Unix() {
|
||||
@@ -70,7 +70,7 @@ func (store *MemoStore) Gets(keys []string, prefix string) (map[string]interface
|
||||
var notFound = make([]string, 0, len(keys))
|
||||
|
||||
for _, key := range keys {
|
||||
if value, ok := store.Store.Load(prefix + key); ok {
|
||||
if value, ok := getValue(store.Store.Load(prefix + key)); ok {
|
||||
res[key] = value
|
||||
} else {
|
||||
notFound = append(notFound, key)
|
||||
|
||||
Reference in New Issue
Block a user