Ver código fonte

feat: CachedConn SetWithExpire

double.huang 4 anos atrás
pai
commit
7fac117e00
1 arquivos alterados com 5 adições e 0 exclusões
  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)