Class PunishmentReasonCache
java.lang.Object
de.murmelmeister.murmelapi.punishment.reason.PunishmentReasonCache
- All Implemented Interfaces:
RefreshListener,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate final com.github.benmanes.caffeine.cache.LoadingCache<Integer, PunishmentReason> private final com.github.benmanes.caffeine.cache.LoadingCache<Integer, List<PunishmentReason>> private final de.murmelmeister.library.database.Databaseprivate final Longprivate final com.github.benmanes.caffeine.cache.LoadingCache<String, List<PunishmentReason>> private final String -
Constructor Summary
ConstructorsConstructorDescriptionPunishmentReasonCache(de.murmelmeister.library.database.Database database, String tableName, Long fetchLimit, long cacheCapcity, Duration refreshInterval) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidclose()getById(int reasonId) getByType(int typeId) private List<PunishmentReason> private PunishmentReasonloadById(int reasonId) private List<PunishmentReason> loadByType(int typeId) voidonRefresh(RefreshEvent<?> event) voidput(PunishmentReason reason) private voidprivate voidrefreshSingle(int reasonId) voidremove(int reasonId)
-
Field Details
-
ALL_KEY
- See Also:
-
database
private final de.murmelmeister.library.database.Database database -
tableName
-
cacheById
-
cacheByType
private final com.github.benmanes.caffeine.cache.LoadingCache<Integer,List<PunishmentReason>> cacheByType -
listCache
private final com.github.benmanes.caffeine.cache.LoadingCache<String,List<PunishmentReason>> listCache -
fetchLimit
-
-
Constructor Details
-
PunishmentReasonCache
-
-
Method Details
-
onRefresh
- Specified by:
onRefreshin interfaceRefreshListener
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
refreshAll
private void refreshAll() -
refreshSingle
private void refreshSingle(int reasonId) -
loadAllFromDatabase
-
loadByType
-
loadById
-
getById
-
getByType
-
put
-
remove
public void remove(int reasonId) -
clear
public void clear() -
getCachedPunishReasons
-