Package io.higson.runtime.core.domain
Class AbstractDomainCacheManager
java.lang.Object
io.higson.runtime.core.domain.AbstractDomainCacheManager
- All Implemented Interfaces:
DomainCacheManager
- Direct Known Subclasses:
MpDomainCacheManager
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractDomainCacheManager(MpDomainCacheProvider cacheProvider, MpDomainRefreshController refreshController) -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsProfileCode(String profileCode, CacheKey entryKey) Set of profiles (head + session), which have at least one domain element.Returns domain object from given domain's path in head state.getByPath(String profileCode, String path, EffectiveVersionConfiguration configuration) Returns domain object from given domain's path.Set of profiles (only HEAD), which have at least one domain element.getSessionElementByPath(String profileCode, String user, String path) Returns domain object from given domain's path.booleanhasRootInCache(String profile) Best-effort, DB-free check whether a domain tree for the given profile is already cached and has a root type.voidMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.higson.runtime.core.domain.DomainCacheManager
getSessionElementByPath, invalidateTreeVersionCachesAfter, wasSomethingChange
-
Constructor Details
-
AbstractDomainCacheManager
public AbstractDomainCacheManager(MpDomainCacheProvider cacheProvider, MpDomainRefreshController refreshController)
-
-
Method Details
-
getProfiles
Set of profiles (only HEAD), which have at least one domain element.- Specified by:
getProfilesin interfaceDomainCacheManager- Returns:
- set of profiles codes
-
hasRootInCache
Best-effort, DB-free check whether a domain tree for the given profile is already cached and has a root type. Checks bothheadElementsByProfilesandsessionElementsByCacheKey- callers such as Studio mostly populate the session map (seerefreshSessionsOfProfileAndUser(java.lang.String, java.lang.String, io.higson.runtime.core.versioninterceptor.EffectiveVersionConfiguration)) and never touch the head map at all, so relying on the head map alone would make this method report a false "nothing cached" for them. The session map's entries are re-checked forTreeDomain.isAnyRoot()explicitly, rather than trusting an invariant on write, to stay correct even if a future write path stops guaranteeing it. Returnsfalsewhen nothing usable is cached, so the caller can fall back to a database check. Intentionally never reports a definitive "no root" to avoid acting on a stale or absent cache entry. -
getAllProfiles
Set of profiles (head + session), which have at least one domain element.- Specified by:
getAllProfilesin interfaceDomainCacheManager- Returns:
- set of profiles codes
-
getByPath
Description copied from interface:DomainCacheManagerReturns domain object from given domain's path in head state. Uses system active versions to resolve domain tree. Domain is created only from head elements, session changes are not visible. If you want to get domain element with session changes. useDomainCacheManager.getSessionElementByPath(String, String, String)- Specified by:
getByPathin interfaceDomainCacheManager- Parameters:
profileCode- profile code to fetch its domainpath- domain's path, i.e./PLANS[LIAB]/OPTIONS[OPT1]- Returns:
- found domain object or null, if object does not exist
-
getByPath
public DomainObject getByPath(String profileCode, String path, EffectiveVersionConfiguration configuration) Description copied from interface:DomainCacheManagerReturns domain object from given domain's path. Domain is created only from head elements, session changes are not visible. If you want to get domain element with session changes. useDomainCacheManager.getSessionElementByPath(String, String, String, EffectiveVersionConfiguration)- Specified by:
getByPathin interfaceDomainCacheManager- Parameters:
profileCode- profile code to fetch its domainpath- domain's path, i.e./PLANS[LIAB]/OPTIONS[OPT1]configuration- configuration to override specific version or date. Active system versions will be used if not present- Returns:
- found domain object or null, if object does not exist
- See Also:
-
containsProfileCode
-
getSessionElementByPath
Description copied from interface:DomainCacheManagerReturns domain object from given domain's path. Domain is created from head elements + elements from user's session- Specified by:
getSessionElementByPathin interfaceDomainCacheManager- Parameters:
profileCode- profile code to fetch its domainuser- user nickname to get specific sessionpath- domain's path, i.e./PLANS[LIAB]/OPTIONS[OPT1]- Returns:
- found domain object or null, if object does not exist
-
invalidateAllCaches
public void invalidateAllCaches()- Specified by:
invalidateAllCachesin interfaceDomainCacheManager
-