Documentation
¶
Overview ¶
Package ephemeral 提供短期 TTL KV:不版本化、不持久,纯内存 + 到点自动过期。
与 pkg/domain/storage 互补:storage 是版本化 KV + OCC(重,用于存档/配置), 本包是轻量过期缓存(用于匹配房间临时数据 / 短期 token 缓存 / 排行榜快照 / 验证码)。
ephemeral storage 语义:
- Set(key, value, ttl):ttl 到点自动过期,Get 返回 (value, ok);
- 底层 map + 单 goroutine 定时清扫(参考 pkg/token 的 gc 模式);
- 并发安全(sync.RWMutex + channel-driven gc)。
零值不可用,用 New 构造。Store 并发安全,Stop 后清扫 goroutine 退出。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.