user/pkg/captcha/store.go
timerzz e7e3309896 优化Docker构建流程
- 添加UPX压缩步骤减小可执行文件体积
- 使用多阶段构建减小最终镜像大小
- 更新基础镜像到最新版本
2025-04-22 17:30:36 +08:00

29 lines
666 B
Go

package captcha
import (
"context"
"time"
"github.com/redis/go-redis/v9"
)
type redisStore struct {
client *redis.Client
}
func NewRedisStore(client *redis.Client) Store {
return &redisStore{client: client}
}
func (s *redisStore) Set(ctx context.Context, key string, value string, timeout time.Duration) error {
return s.client.Set(ctx, key, value, timeout).Err()
}
func (s *redisStore) Get(ctx context.Context, key string) (string, error) {
return s.client.Get(ctx, key).Result()
}
func (s *redisStore) Delete(ctx context.Context, key string) error {
return s.client.Del(ctx, key).Err()
}
func (s *redisStore) Close() error {
return s.client.Close()
}