diff --git a/routers/repo/attachment_dir.go b/routers/repo/attachment_dir.go index 82e0074f82..5af24b5c62 100644 --- a/routers/repo/attachment_dir.go +++ b/routers/repo/attachment_dir.go @@ -37,6 +37,8 @@ func GetDirSomeFiles(ctx *context.Context) { cacheResult, err := getAttachmentDirFromCache(cacheKey) if err == nil { log.Info("load from cache.") + //update redis status + setAttachmentDirToCache(cacheKey, *cacheResult) ctx.JSON(200, map[string]interface{}{ "result_code": "0", "data": cacheResult.DirList, @@ -338,7 +340,7 @@ func setAttachmentDirToCache(msgKey string, dirList DirRedisCache) { msgMapJson, _ := json.Marshal(dirList) redisValue := string(msgMapJson) log.Info("set redis key=" + msgKey + " value=" + redisValue) - re, err := redis_client.Setex(msgKey, redisValue, 7*24*3600*time.Second) + re, err := redis_client.Setex(msgKey, redisValue, 30*24*3600*time.Second) if err == nil { log.Info("re =" + fmt.Sprint(re)) } else {