Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
leo authored and leo committed Oct 20, 2021
1 parent 6a658d4 commit f998c1d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cache_util/goredis/cluster/ttl.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cluster
import (
"context"
"math/rand"
"time"

gofastcache "github.com/daqnext/go-fast-cache"
"github.com/daqnext/utils/cache_util"
Expand Down Expand Up @@ -41,3 +42,9 @@ func SmartCheck_LocalCache_Redis(ctx context.Context, Redis *redis.ClusterClient
}
return nil, 0, false
}

func SmartSet_LocalCache_Redis(ctx context.Context, Redis *redis.ClusterClient, LocalCache *gofastcache.LocalCache, keystr string, value interface{}, ttlSecond int64) {
LocalCache.Set(keystr, value, ttlSecond)
strsrc := LocalCache.SetRand(keystr, ttlSecond+10)
Redis.Set(ctx, keystr, strsrc, time.Duration(ttlSecond+30)*time.Second)
}

0 comments on commit f998c1d

Please sign in to comment.