feat: cache topic and subscription reads

This commit is contained in:
richjohnrambo
2026-09-24 14:46:00 +08:00
parent 0881256103
commit f952249dc3
4 changed files with 74 additions and 12 deletions
+3 -1
View File
@@ -1497,7 +1497,9 @@ func (r *redisGroupMessageRuntime) loginSessionKey(tokenHash string) string {
func (r *redisGroupMessageRuntime) cacheTTL(namespace string) time.Duration {
ttl := r.cfg.CacheTTL
if namespace == "verification" || namespace == "action_token" || namespace == "login_lockout" {
if namespace == cacheNamespaceTopic || namespace == cacheNamespaceSub {
ttl = 60
} else if namespace == "verification" || namespace == "action_token" || namespace == "login_lockout" {
ttl = r.cfg.ShortTTL
}
return time.Duration(ttl) * time.Second