Initial commit

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 13:57:10 +08:00
co-authored by Claude Opus 5
commit 8679200f41
1897 changed files with 257900 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
package cache
import (
"time"
cache "github.com/robfig/go-cache"
)
// Cache 服务单机本地缓存
type Cache struct {
Expiration time.Duration
CleanInterval time.Duration
Cli *cache.Cache
}
// New 创建缓存客户端
func (c *Cache) New() {
c.Cli = cache.New(c.Expiration, c.CleanInterval)
}
// Set 设置键值
func (c *Cache) Set(key string, value interface{}, expiration time.Duration) {
c.Cli.Set(key, value, expiration)
}
// Get 获取值
func (c *Cache) Get(key string) (result interface{}, exists bool) {
return c.Cli.Get(key)
}
// Add 添加值
func (c *Cache) Add(key string, value interface{}, expiration time.Duration) error {
return c.Cli.Add(key, value, expiration)
}