Browse Source

Set redis key ttl with entry.TTLSec

pull/821/head
byungjo.yoon 6 years ago
parent
commit
58fd2e5a19
  1. 3
      weed/filer2/redis/universal_redis_store.go

3
weed/filer2/redis/universal_redis_store.go

@ -7,6 +7,7 @@ import (
"github.com/go-redis/redis" "github.com/go-redis/redis"
"sort" "sort"
"strings" "strings"
"time"
) )
const ( 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) 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 { if err != nil {
return fmt.Errorf("persisting %s : %v", entry.FullPath, err) return fmt.Errorf("persisting %s : %v", entry.FullPath, err)

Loading…
Cancel
Save