shikeyin
2024-01-11 65da8373531677b1c37a98f53eaa30c892f35e5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.iplatform.base.cache;
 
import com.iplatform.base.Constants;
import com.walker.cache.Cache;
import com.walker.support.redis.cache.RedisCacheProvider;
 
/**
 * 验证码(Redis)缓存实现。
 * @date 2022-11-07
 */
public class RedisCaptchaCacheProvider extends RedisCacheProvider<String> {
 
    public RedisCaptchaCacheProvider(){
        this.setUseRedis(true);
        this.setLoadPage(false);
        // 2024-01-05 设置支持缓存失效,该参数很重要,如果需要失效而没有设置在调用后会出现数据无法失效!
        this.setSupportExpiredCache(true);
    }
 
    @Override
    public String getProviderName() {
        return Constants.CACHE_NAME_CAPTCHA;
    }
 
    @Override
    public Class<?> getProviderType() {
        return String.class;
    }
 
    @Override
    protected int loadDataToCache(Cache cache){
        // 无需启动加载数据
        return 0;
    }
}