[Update] HotDataCacheStore, Cleanable 更新Javadoc;

This commit is contained in:
LamGC 2020-06-03 17:03:54 +08:00
parent b4e9fdab7d
commit ef70ac77cb
2 changed files with 8 additions and 1 deletions

View File

@ -1,10 +1,13 @@
package net.lamgc.cgj.bot.cache; package net.lamgc.cgj.bot.cache;
/** /**
* 可清理接口, 实现该接口代表该类有清理动作. * 可清理接口, 实现该接口代表该类有清理动作.
*/ */
public interface Cleanable { public interface Cleanable {
/**
* 该方法需要CacheStore完成对过期Entry的清除.
*/
void clean() throws Exception; void clean() throws Exception;
} }

View File

@ -133,6 +133,10 @@ public class HotDataCacheStore<T> implements CacheStore<T>, Cleanable {
return current.supportedList() && parent.supportedList(); return current.supportedList() && parent.supportedList();
} }
/**
* 检查并清理已过期的Entry.
* <p>该方法仅清理Current缓存库, 不会对上游缓存库造成影响.</p>
*/
@Override @Override
public void clean() { public void clean() {
for(String key : this.current.keys()) { for(String key : this.current.keys()) {