Class CacheMap

All Implemented Interfaces:
Serializable, ConcurrentMap<ICacheKey<?>, List<ICacheValue<?>>>, Map<ICacheKey<?>, List<ICacheValue<?>>>

public class CacheMap extends ConcurrentHashMap<ICacheKey<?>, List<ICacheValue<?>>>
See Also:
  • Field Details

    • INSTANCE

      public static CacheMap INSTANCE
  • Constructor Details

    • CacheMap

      public CacheMap()
  • Method Details

    • getCacheMap

      public static CacheMap getCacheMap()
    • add

      public void add(ICacheKey<?> cacheKey, ICacheValue<?> newValue)
    • getBucket

      public List<ICacheValue<?>> getBucket(ICacheKey<?> key)
    • unwrap

      public <T> T unwrap(ICacheValue<?> wrapper, Class<T> type)
      Type-Safe Extraction helper. You pass the Wrapper you got, and the Class you expect inside it. We handle the ugly casting here so your service code stays clean.
    • containsInBucket

      public boolean containsInBucket(Class<?> domainKey, ICacheValue<?> value)
    • removeValue

      public void removeValue(ICacheValue<?> valueToRemove)
      Removes a specific Wrapper value from the bucket, but keeps the Key. This supports your "Key persists, Value eliminated" logic.
    • removeCacheKey

      public void removeCacheKey(ICacheKey<?> key)
      Hard delete of the Key (and its entire bucket).
    • containsDomainKey

      public boolean containsDomainKey(ICacheKey<?> key)
    • containsPayload

      public boolean containsPayload(ICacheKey<?> key, Object realPayload)
      Checks if the REAL domain object (payload) already exists in the bucket. Unwraps the CacheValue and compares the inner object using .equals().
    • findByDomain

      public List<List<ICacheValue<?>>> findByDomain(CacheDomain domain)
    • findByType

      public List<List<ICacheValue<?>>> findByType(CacheType type)