Browse Source

feat: CachedConn SetWithExpire

double.huang 2 years ago
parent
commit
7fac117e00
1 changed files with 5 additions and 0 deletions
  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)