Class AbstractCountStampManager
java.lang.Object
cn.herodotus.engine.cache.jetcache.stamp.AbstractStampManager<String,Long>
cn.herodotus.engine.cache.jetcache.stamp.AbstractCountStampManager
- All Implemented Interfaces:
StampManager<String,,Long> org.springframework.beans.factory.InitializingBean
Description: 计数类型的缓存
这里的泛型使用了 Long 主要是为了兼顾存储 System.currentTimeMillis()。否则类型不一致,还要建两个 Stamp
- Author:
- : gengwei.zheng
- Date:
- : 2022/7/6 22:59
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractCountStampManager(String cacheName) AbstractCountStampManager(String cacheName, com.alicp.jetcache.anno.CacheType cacheType) AbstractCountStampManager(String cacheName, com.alicp.jetcache.anno.CacheType cacheType, Duration expire) -
Method Summary
Modifier and TypeMethodDescriptionint在缓存有效期内进行计数int在缓存有效期内进行计数int在缓存有效期内进行计数int在缓存有效期内进行计数int在缓存有效期内进行计数int在缓存有效期内进行计数intvoidsetMaxTimes(int maxTimes) Methods inherited from class cn.herodotus.engine.cache.jetcache.stamp.AbstractStampManager
check, delete, get, getCache, getExpire, lock, lockAndRun, put, setExpireMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.InitializingBean
afterPropertiesSetMethods inherited from interface cn.herodotus.engine.cache.jetcache.stamp.StampManager
containKey, create, create, create, lock, lock, lockAndRun, lockAndRun, nextStamp, put, put
-
Constructor Details
-
AbstractCountStampManager
-
AbstractCountStampManager
-
AbstractCountStampManager
-
-
Method Details
-
counting
public int counting(String identity) throws cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException 在缓存有效期内进行计数- Parameters:
identity- 缓存 Key 的区分标识- Returns:
- 当前错误次数
- Throws:
cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException- 超出最大限制次数错误
-
counting
public int counting(String identity, int maxTimes) throws cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException 在缓存有效期内进行计数- Parameters:
identity- 缓存 Key 的区分标识maxTimes- 允许的最大限制次数- Returns:
- 当前错误次数
- Throws:
cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException- 超出最大限制次数错误
-
counting
public int counting(String identity, int maxTimes, Duration expire) throws cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException 在缓存有效期内进行计数- Parameters:
identity- 缓存 Key 的区分标识maxTimes- 允许的最大限制次数expire- 过期时间- Returns:
- 当前错误次数
- Throws:
cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException- 超出最大限制次数错误
-
counting
public int counting(String identity, int maxTimes, Duration expire, String function) throws cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException 在缓存有效期内进行计数- Parameters:
identity- 缓存 Key 的区分标识maxTimes- 允许的最大限制次数expire- 过期时间function- 用于在日志中区分是哪个功能在调用。- Returns:
- 当前错误次数
- Throws:
cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException- 超出最大限制次数错误
-
counting
public int counting(String identity, int maxTimes, Duration expire, boolean useMd5) throws cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException 在缓存有效期内进行计数- Parameters:
identity- 缓存 Key 的区分标识maxTimes- 允许的最大限制次数expire- 过期时间useMd5- 是否用 MD5 对区分标识进行混淆加密- Returns:
- 当前错误次数
- Throws:
cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException- 超出最大限制次数错误
-
counting
public int counting(String identity, int maxTimes, Duration expire, boolean useMd5, String function) throws cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException 在缓存有效期内进行计数- Parameters:
identity- 缓存 Key 的区分标识maxTimes- 允许的最大限制次数expire- 过期时间useMd5- 是否用 MD5 对区分标识进行混淆加密function- 用于在日志中区分是哪个功能在调用。- Returns:
- 当前错误次数
- Throws:
cn.herodotus.engine.cache.core.exception.MaximumLimitExceededException- 超出最大限制次数错误
-
getMaxTimes
public int getMaxTimes() -
setMaxTimes
public void setMaxTimes(int maxTimes)
-