From 58fd2e5a19419d82bf2f6b408de7b30e98c5d69c Mon Sep 17 00:00:00 2001 From: "byungjo.yoon" Date: Wed, 9 Jan 2019 11:48:19 +0900 Subject: [PATCH] Set redis key ttl with entry.TTLSec --- weed/filer2/redis/universal_redis_store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/weed/filer2/redis/universal_redis_store.go b/weed/filer2/redis/universal_redis_store.go index a5d57b598..c7daf1042 100644 --- a/weed/filer2/redis/universal_redis_store.go +++ b/weed/filer2/redis/universal_redis_store.go @@ -7,6 +7,7 @@ import ( "github.com/go-redis/redis" "sort" "strings" + "time" ) const ( @@ -24,7 +25,7 @@ func (store *UniversalRedisStore) InsertEntry(entry *filer2.Entry) (err error) { return fmt.Errorf("encoding %s %+v: %v", entry.FullPath, entry.Attr, err) } - _, err = store.Client.Set(string(entry.FullPath), value, 0).Result() + _, err = store.Client.Set(string(entry.FullPath), value, time.Duration(entry.TtlSec) * time.Second).Result() if err != nil { return fmt.Errorf("persisting %s : %v", entry.FullPath, err)