Class AbstractDomainCacheManager

java.lang.Object
io.higson.runtime.core.domain.AbstractDomainCacheManager
All Implemented Interfaces:
DomainCacheManager
Direct Known Subclasses:
MpDomainCacheManager

public abstract class AbstractDomainCacheManager extends Object implements DomainCacheManager
  • Constructor Details

  • Method Details

    • getProfiles

      public Set<String> getProfiles()
      Set of profiles (only HEAD), which have at least one domain element.
      Specified by:
      getProfiles in interface DomainCacheManager
      Returns:
      set of profiles codes
    • hasRootInCache

      public boolean hasRootInCache(String profile)
      Best-effort, DB-free check whether a domain tree for the given profile is already cached and has a root type. Checks both headElementsByProfiles and sessionElementsByCacheKey - callers such as Studio mostly populate the session map (see refreshSessionsOfProfileAndUser(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 for TreeDomain.isAnyRoot() explicitly, rather than trusting an invariant on write, to stay correct even if a future write path stops guaranteeing it. Returns false when 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

      public Set<String> getAllProfiles()
      Set of profiles (head + session), which have at least one domain element.
      Specified by:
      getAllProfiles in interface DomainCacheManager
      Returns:
      set of profiles codes
    • getByPath

      public DomainObject getByPath(String profileCode, String path)
      Description copied from interface: DomainCacheManager
      Returns 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. use DomainCacheManager.getSessionElementByPath(String, String, String)
      Specified by:
      getByPath in interface DomainCacheManager
      Parameters:
      profileCode - profile code to fetch its domain
      path - 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: DomainCacheManager
      Returns 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. use DomainCacheManager.getSessionElementByPath(String, String, String, EffectiveVersionConfiguration)
      Specified by:
      getByPath in interface DomainCacheManager
      Parameters:
      profileCode - profile code to fetch its domain
      path - 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

      public boolean containsProfileCode(String profileCode, CacheKey entryKey)
    • getSessionElementByPath

      public DomainObject getSessionElementByPath(String profileCode, String user, String path)
      Description copied from interface: DomainCacheManager
      Returns domain object from given domain's path. Domain is created from head elements + elements from user's session
      Specified by:
      getSessionElementByPath in interface DomainCacheManager
      Parameters:
      profileCode - profile code to fetch its domain
      user - user nickname to get specific session
      path - 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:
      invalidateAllCaches in interface DomainCacheManager