Class UserParentCache
java.lang.Object
de.murmelmeister.murmelapi.user.parent.UserParentCache
- 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<UserParentCache.ParentKey, UserParent> private final com.github.benmanes.caffeine.cache.LoadingCache<Integer, List<UserParent>> private final de.murmelmeister.library.database.Databaseprivate final Longprivate static final Patternprivate final com.github.benmanes.caffeine.cache.LoadingCache<String, List<UserParent>> private final String -
Constructor Summary
ConstructorsConstructorDescriptionUserParentCache(de.murmelmeister.library.database.Database database, String tableName, Long fetchLimit, long cacheCapacity, Duration refreshInterval) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()voidclose()get(int userId, int parentId) getParents(int userId) private List<UserParent> private UserParentprivate List<UserParent> loadByUserId(int userId) voidonRefresh(RefreshEvent<?> event) voidput(UserParent userParent) private voidprivate voidrefreshSingle(int userId) private voidvoidremove(int userId) voidremove(int userId, int parentId)
-
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<UserParentCache.ParentKey,UserParent> cacheByKey -
cacheByUserId
private final com.github.benmanes.caffeine.cache.LoadingCache<Integer,List<UserParent>> cacheByUserId -
listCache
-
fetchLimit
-
-
Constructor Details
-
UserParentCache
-
-
Method Details
-
onRefresh
- Specified by:
onRefreshin interfaceRefreshListener
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
refreshAll
private void refreshAll() -
refreshSingle
private void refreshSingle(int userId) -
refreshSingle
-
loadAllFromDatabase
-
loadByUserId
-
loadByKey
-
get
-
getParents
-
put
-
remove
public void remove(int userId, int parentId) -
remove
public void remove(int userId) -
clear
public void clear() -
getCachedParents
-