Update the auth controller

Signed-off-by: Nikolai Rodionov <iam@allanger.xyz>
This commit is contained in:
2026-05-18 14:20:29 +02:00
parent 26cf743f12
commit ccf2f3d157
2 changed files with 27 additions and 15 deletions

View File

@@ -9,7 +9,8 @@ import (
)
const (
CacheFolderToken = "token"
CacheFolderToken = "token"
CacheFolderSessions = "session"
)
func buildKey(folder, key string) string {
@@ -23,3 +24,7 @@ func GetFromCache(ctx context.Context, redis *redis.Client, folder, key string)
func SaveToCache(ctx context.Context, redis *redis.Client, folder, key, value string, ttl time.Duration) error {
return redis.Set(ctx, buildKey(folder, key), value, ttl).Err()
}
func DeleteFromCache(ctx context.Context, redis *redis.Client, folder, key string) error {
return redis.Del(ctx, buildKey(folder, key)).Err()
}