Class GroupColorCache
java.lang.Object
de.murmelmeister.murmelapi.group.color.GroupColorCache
- All Implemented Interfaces:
RefreshListener,AutoCloseable
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate final com.github.benmanes.caffeine.cache.LoadingCache<Integer, List<GroupColor>> private final com.github.benmanes.caffeine.cache.LoadingCache<GroupColorCache.ColorKey, GroupColor> private final de.murmelmeister.library.database.Databaseprivate final Longprivate static final Patternprivate final com.github.benmanes.caffeine.cache.LoadingCache<String, List<GroupColor>> private final String -
Constructor Summary
ConstructorsConstructorDescriptionGroupColorCache(de.murmelmeister.library.database.Database database, String tableName, Long fetchLimit, long cacheCapcity, Duration refreshInterval) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidclose()get(int groupId, int typeId) getByGroupId(int groupId) private List<GroupColor> private List<GroupColor> loadByGroupId(int groupId) private GroupColorvoidonRefresh(RefreshEvent<?> event) voidput(GroupColor groupColor) private voidprivate voidrefreshSingle(int groupId) private voidvoidremove(int groupId) voidremove(int groupId, int typeId)
-
Field Details
-
ALL_KEY
- See Also:
-
KEY_PATTERN
-
database
private final de.murmelmeister.library.database.Database database -
tableName
-
cacheByKey
private final com.github.benmanes.caffeine.cache.LoadingCache<GroupColorCache.ColorKey,GroupColor> cacheByKey -
cacheByGroupId
private final com.github.benmanes.caffeine.cache.LoadingCache<Integer,List<GroupColor>> cacheByGroupId -
listCache
-
fetchLimit
-
-
Constructor Details
-
GroupColorCache
-
-
Method Details
-
onRefresh
- Specified by:
onRefreshin interfaceRefreshListener
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
refreshAll
private void refreshAll() -
refreshSingle
private void refreshSingle(int groupId) -
refreshSingle
-
loadAllFromDatabase
-
loadByGroupId
-
loadByKey
-
get
-
getByGroupId
-
put
-
remove
public void remove(int groupId, int typeId) -
remove
public void remove(int groupId) -
clear
public void clear() -
getCachedColors
-