public class MembershipCache extends Object
| Constructor and Description |
|---|
MembershipCache(CacheFactory cacheFactory,
Set<QueryType> cacheableTypes,
Duration cacheTtl,
int groupMembershipCacheMax,
int queryTypeInvalidationThreshold,
DirectoryEntityResolver entityResolver,
ScheduledExecutorService cleanupPool) |
| Modifier and Type | Method and Description |
|---|---|
int |
cacheCount() |
void |
clear() |
void |
clear(long directoryId) |
<T> List<T> |
get(long directoryId,
QueryType queryType,
String key,
Class<T> returnType) |
Set<QueryType> |
getCacheableTypes() |
protected CacheInvalidations |
getCacheInvalidation() |
List<String> |
getNames(long directoryId,
QueryType queryType,
String key) |
protected com.atlassian.cache.Cache<String,List<String>> |
getOrCreateCache(com.atlassian.crowd.dao.membership.cache.QueryTypeCacheKey cacheKey) |
void |
invalidateCache(long directoryId) |
void |
invalidateCache(long directoryId,
QueryType queryType) |
void |
invalidateCache(long directoryId,
QueryType queryType,
String key) |
protected boolean |
isInvalidated(com.atlassian.crowd.dao.membership.cache.QueryTypeCacheKey cacheKey,
String key) |
protected void |
processInvalidations(CacheInvalidations invalidations) |
<T> void |
put(long directoryId,
QueryType queryType,
String key,
List<T> data) |
boolean |
supports(Class<?> resultClass) |
public MembershipCache(CacheFactory cacheFactory, Set<QueryType> cacheableTypes, Duration cacheTtl, int groupMembershipCacheMax, int queryTypeInvalidationThreshold, @Nullable DirectoryEntityResolver entityResolver, ScheduledExecutorService cleanupPool)
cacheFactory - factory which will be used to create caches - 1 per directory and query type paircacheableTypes - set of query types that should be cachedcacheTtl - time for which entries are valid after writegroupMembershipCacheMax - maximum cache size (per directory and query type pair)queryTypeInvalidationThreshold - when number of invalidated keys goes above this threshold then all entries
for the given query type will be invalidated; this allows to limit the number
of invalidation messages sent to the clusterentityResolver - implementation of DirectoryEntityResolver to translate entity names to entities;
there are following options:
null will result in only names caching. Entity query
results will never be returned from cache, however the names of the
results of such query will be cached.LocallyCachedDirectoryEntityResolver. The cache does not expire
entities on modifications, so it may return stale data.DirectoryEntityResolver. This is
especially useful if product already caches entities by name.cleanupPool - thread pool for cache cleanup taskpublic void invalidateCache(long directoryId)
public void invalidateCache(long directoryId,
QueryType queryType)
@Nullable public <T> List<T> get(long directoryId, QueryType queryType, String key, Class<T> returnType)
protected void processInvalidations(CacheInvalidations invalidations)
protected com.atlassian.cache.Cache<String,List<String>> getOrCreateCache(com.atlassian.crowd.dao.membership.cache.QueryTypeCacheKey cacheKey)
protected CacheInvalidations getCacheInvalidation()
protected boolean isInvalidated(com.atlassian.crowd.dao.membership.cache.QueryTypeCacheKey cacheKey, String key)
public void clear()
public void clear(long directoryId)
public int cacheCount()
public boolean supports(Class<?> resultClass)
Copyright © 2023 Atlassian. All rights reserved.