Interface Cache<K,​V extends Identifiable<K>>

    • Method Detail

      • create

        V create()
        Creates and caches a new instance of T.
        Returns:
        a new T
      • get

        V get​(K key)
        Get the specified object from cache. This will mark the object as being in use, and increase its usage count.
        Parameters:
        key - the identifier of the object
        Returns:
        the object, or null if it does not exist
      • release

        void release​(V obj)
        Decreases the objects usage count. If the usage count hits 0 then the object will be released.
        Parameters:
        obj - the object
      • contains

        boolean contains​(K key)
        Indicates whether or not the specified key is contained within this cache.
        Parameters:
        key - the cache key
        Returns:
        true if the key is present in the cache, false otherwise.
      • discard

        void discard​(V obj)
        Discard the specified object from cache.
        Parameters:
        obj - the object to discard
      • remove

        void remove​(K key)
        Remove and destroy the specified object from cache.
        Parameters:
        key - the identifier of the object
      • getCacheSize

        int getCacheSize()
      • getPassivatedCount

        int getPassivatedCount()
      • getTotalSize

        int getTotalSize()
      • isRemotable

        default boolean isRemotable​(Throwable throwable)
        Checks whether the supplied Throwable is remotable meaning it can be safely sent to the client over the wire.
      • getIdentifierFactory

        Supplier<K> getIdentifierFactory()
        Returns the identifier factory of this cache.
        Returns:
        an identifier factory