Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore 是使用 Redis 实现的自定义验证码存储结构体
func NewRedisStore ¶
func NewRedisStore(redisClient *redis.Client, expiry time.Duration) *RedisStore
NewRedisStore 创建一个 RedisStore 实例
func (*RedisStore) Get ¶
func (s *RedisStore) Get(id string, clear bool) string
Get 从 Redis 中获取指定 id 的验证码 如果 clear 为 true,则从 Redis 中删除该验证码
func (*RedisStore) Set ¶
func (s *RedisStore) Set(id string, value string) error
Set 将验证码的值存储到 Redis 中,并返回可能的错误
func (*RedisStore) Verify ¶
func (s *RedisStore) Verify(id, answer string, clear bool) bool
Verify 验证用户提供的答案是否与存储的验证码匹配 如果 clear 为 true,则从 Redis 中删除验证码
Click to show internal directories.
Click to hide internal directories.