提交 cbcad6dd 编写于 作者: 如梦技术's avatar 如梦技术 🐛

mica-captcha 优化注释。

上级 63f220ac
......@@ -35,6 +35,10 @@ public interface ICaptchaCache {
/**
* 保存缓存
*
* <p>
* 非 spring cache 等启动就确定超时的缓存,重新改方法
* </p>
*
* @param cacheKey 缓存key
* @param value 缓存value
* @param ttlInMillis ttl
......@@ -59,6 +63,10 @@ public interface ICaptchaCache {
/**
* 获取并删除缓存,验证码不管成功只能验证一次
*
* <p>
* 非 spring cache 等启动就确定超时的缓存,重新改方法
* </p>
*
* @param cacheKey 缓存空间
* @return 验证码
*/
......
......@@ -36,13 +36,13 @@ public class SpringCacheCaptchaCache implements ICaptchaCache, InitializingBean
@Override
public void put(String cacheName, String uuid, String value) {
Cache captchaCache = getCache();
Cache captchaCache = getCache(cacheName);
captchaCache.put(uuid, value);
}
@Override
public String getAndRemove(String cacheName, String uuid) {
Cache captchaCache = getCache();
Cache captchaCache = getCache(cacheName);
String value = captchaCache.get(uuid, String.class);
if (value != null) {
captchaCache.evict(uuid);
......@@ -55,8 +55,7 @@ public class SpringCacheCaptchaCache implements ICaptchaCache, InitializingBean
*
* @return Cache
*/
private Cache getCache() {
String cacheName = properties.getCacheName();
private Cache getCache(String cacheName) {
return cacheManager.getCache(cacheName);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册