MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / NewPostCache

Function NewPostCache

internal/repository/cache/post.go:43–55  ·  view source on GitHub ↗
(client redis.Cmdable)

Source from the content-addressed store, hash-verified

41}
42
43func NewPostCache(client redis.Cmdable) PostCache {
44 rand.Seed(time.Now().UnixNano()) // 初始化随机数种子
45 return &postCache{
46 client: client,
47 expiration: time.Minute * 30, // 基础过期时间30分钟
48 prefix: "linkeme:post:",
49 emptyPrefix: "linkeme:post:empty:",
50 listPrefix: "linkeme:post:list:",
51 listPubPrefix: "linkeme:post:list:pub:",
52 pubPrefix: "linkeme:post:pub:",
53 lockPrefix: "linkeme:post:lock:",
54 }
55}
56
57// Get 获取帖子缓存
58func (c *postCache) Get(ctx context.Context, key string) (domain.Post, error) {

Callers 1

InitWebServerFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected