mirror of https://github.com/cloudreve/Cloudreve
Fix: missing ttl check in memstore.Get
parent
3e49c9f4f6
commit
327765a7be
|
@ -163,14 +163,13 @@ func (file *File) UpdatePicInfo(value string) error {
|
||||||
return DB.Model(&file).Update("pic_info", value).Error
|
return DB.Model(&file).Update("pic_info", value).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdatePicInfo 更新文件的图像信息
|
// UpdateSize 更新文件的大小信息
|
||||||
func (file *File) UpdateSize(value uint64) error {
|
func (file *File) UpdateSize(value uint64) error {
|
||||||
return DB.Model(&file).Update("size", value).Error
|
return DB.Model(&file).Update("size", value).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
实现 FileInfo.FileInfo 接口
|
实现 FileInfo.FileInfo 接口
|
||||||
TODO 测试
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func (file *File) GetName() string {
|
func (file *File) GetName() string {
|
||||||
|
|
|
@ -35,7 +35,7 @@ func getValue(item interface{}, ok bool) (interface{}, bool) {
|
||||||
|
|
||||||
var itemObj itemWithTTL
|
var itemObj itemWithTTL
|
||||||
if itemObj, ok = item.(itemWithTTL); !ok {
|
if itemObj, ok = item.(itemWithTTL); !ok {
|
||||||
return nil, false
|
return item, true
|
||||||
}
|
}
|
||||||
|
|
||||||
if itemObj.expires > 0 && itemObj.expires < time.Now().Unix() {
|
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))
|
var notFound = make([]string, 0, len(keys))
|
||||||
|
|
||||||
for _, key := range 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
|
res[key] = value
|
||||||
} else {
|
} else {
|
||||||
notFound = append(notFound, key)
|
notFound = append(notFound, key)
|
||||||
|
|
Loading…
Reference in New Issue