Class SimpleCache<K,​V extends Identifiable<K>>

    • Method Detail

      • getIdentifierFactory

        public Supplier<K> getIdentifierFactory()
        Description copied from interface: Cache
        Returns the identifier factory of this cache.
        Specified by:
        getIdentifierFactory in interface Cache<K,​V extends Identifiable<K>>
        Returns:
        an identifier factory
      • create

        public V create()
        Description copied from interface: Cache
        Creates and caches a new instance of T.
        Specified by:
        create in interface Cache<K,​V extends Identifiable<K>>
        Returns:
        a new T
      • discard

        public void discard​(V value)
        Description copied from interface: Cache
        Discard the specified object from cache.
        Specified by:
        discard in interface Cache<K,​V extends Identifiable<K>>
        Parameters:
        value - the object to discard
      • remove

        public void remove​(K key)
        Description copied from interface: Cache
        Remove and destroy the specified object from cache.
        Specified by:
        remove in interface Cache<K,​V extends Identifiable<K>>
        Parameters:
        key - the identifier of the object
      • get

        public V get​(K key)
        Description copied from interface: Cache
        Get the specified object from cache. This will mark the object as being in use, and increase its usage count.
        Specified by:
        get in interface Cache<K,​V extends Identifiable<K>>
        Parameters:
        key - the identifier of the object
        Returns:
        the object, or null if it does not exist
      • contains

        public boolean contains​(K key)
        Description copied from interface: Cache
        Indicates whether or not the specified key is contained within this cache.
        Specified by:
        contains in interface Cache<K,​V extends Identifiable<K>>
        Parameters:
        key - the cache key
        Returns:
        true if the key is present in the cache, false otherwise.
      • release

        public void release​(V bean)
        Description copied from interface: Cache
        Decreases the objects usage count. If the usage count hits 0 then the object will be released.
        Specified by:
        release in interface Cache<K,​V extends Identifiable<K>>
        Parameters:
        bean - the object
      • test

        public boolean test​(K key)
        Specified by:
        test in interface Predicate<K>