Class StrongRefCache

  • All Implemented Interfaces:
    java.util.Map<java.lang.Object,​DNStateManager>, Level1Cache

    public class StrongRefCache
    extends java.lang.Object
    implements Level1Cache
    Implementation of a Level 1 cache keeping strong references to the objects. This means that objects are not garbage collected, and have to be removed directly by calls to remove(). This differs from the WeakRefCache/SoftRefCache which do not guarantee to retain objects.
    • Constructor Detail

      • StrongRefCache

        public StrongRefCache()
    • Method Detail

      • get

        public DNStateManager get​(java.lang.Object id)
        Specified by:
        get in interface java.util.Map<java.lang.Object,​DNStateManager>
      • containsKey

        public boolean containsKey​(java.lang.Object id)
        Specified by:
        containsKey in interface java.util.Map<java.lang.Object,​DNStateManager>
      • remove

        public DNStateManager remove​(java.lang.Object id)
        Specified by:
        remove in interface java.util.Map<java.lang.Object,​DNStateManager>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<java.lang.Object,​DNStateManager>
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        Specified by:
        containsValue in interface java.util.Map<java.lang.Object,​DNStateManager>
      • entrySet

        public java.util.Set entrySet()
        Specified by:
        entrySet in interface java.util.Map<java.lang.Object,​DNStateManager>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Map<java.lang.Object,​DNStateManager>
      • keySet

        public java.util.Set keySet()
        Specified by:
        keySet in interface java.util.Map<java.lang.Object,​DNStateManager>
      • putAll

        public void putAll​(java.util.Map t)
        Specified by:
        putAll in interface java.util.Map<java.lang.Object,​DNStateManager>
      • size

        public int size()
        Specified by:
        size in interface java.util.Map<java.lang.Object,​DNStateManager>
      • values

        public java.util.Collection values()
        Specified by:
        values in interface java.util.Map<java.lang.Object,​DNStateManager>
      • getUnique

        public DNStateManager getUnique​(CacheUniqueKey key)
        Description copied from interface: Level1Cache
        Method to retrieve StateManager for the specified unique key.
        Specified by:
        getUnique in interface Level1Cache
        Parameters:
        key - Unique key
        Returns:
        StateManager if one is cached for this unique key
      • putUnique

        public java.lang.Object putUnique​(CacheUniqueKey key,
                                          DNStateManager sm)
        Description copied from interface: Level1Cache
        Method to store a StateManager for this unique key.
        Specified by:
        putUnique in interface Level1Cache
        Parameters:
        key - The unique key
        sm - StateManager
        Returns:
        The previous StateManager for this unique key if one was present, otherwise null