Add 'server/' from commit 'e64421295fff83acbb6d6ab3d3b27f3ef8368f00'
git-subtree-dir: server git-subtree-mainline:c4e617ada7git-subtree-split:e64421295f
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package agent
|
||||
|
||||
import "time"
|
||||
|
||||
// 效果图 URL 缓存(key: 方案内容 hash:角度,24h TTL,复用泛型 TTL 缓存)
|
||||
var effectCache = NewTTLCache(24 * time.Hour)
|
||||
|
||||
// CacheGet 读取缓存 URL
|
||||
func CacheGet(key string) (string, bool) {
|
||||
v, ok := effectCache.Get(key)
|
||||
if !ok {
|
||||
return "", false
|
||||
}
|
||||
s, _ := v.(string)
|
||||
return s, s != ""
|
||||
}
|
||||
|
||||
// CacheSet 写入缓存 URL
|
||||
func CacheSet(key, url string) {
|
||||
effectCache.Set(key, url)
|
||||
}
|
||||
Reference in New Issue
Block a user