Pārlūkot izejas kodu

feat: CachedConn SetWithExpire

double.huang 4 gadi atpakaļ
vecāks
revīzija
7fac117e00
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5 0
      core/stores/sqlc/cachedsql.go

+ 5 - 0
core/stores/sqlc/cachedsql.go

@@ -134,6 +134,11 @@ func (cc CachedConn) SetCache(key string, v interface{}) error {
 	return cc.cache.Set(key, v)
 }
 
+// SetWithExpire sets v into cache with given key.
+func (cc CachedConn) SetWithExpire(key string, v interface{}, expire time.Duration) error {
+	return cc.cache.SetWithExpire(key, v, expire)
+}
+
 // Transact runs given fn in transaction mode.
 func (cc CachedConn) Transact(fn func(sqlx.Session) error) error {
 	return cc.db.Transact(fn)