Class NullCache<K extends java.io.Serializable,​V>

  • All Implemented Interfaces:
    org.alfresco.repo.cache.SimpleCache<K,​V>

    public class NullCache<K extends java.io.Serializable,​V>
    extends java.lang.Object
    implements org.alfresco.repo.cache.SimpleCache<K,​V>
    A cache that does nothing - always.

    There are conditions under which code that expects to be caching, should not be. Using this cache, it becomes possible to configure a valid cache in whilst still ensuring that the actual caching is not performed.

    Author:
    Derek Hulley
    • Constructor Summary

      Constructors 
      Constructor Description
      NullCache()  
    • Constructor Detail

      • NullCache

        public NullCache()
    • Method Detail

      • getInstance

        public static final <K extends java.io.Serializable,​V> NullCache<K,​V> getInstance()
        Returns:
        Returns a singleton that can be used in any way - all operations are stateless
      • contains

        public boolean contains​(K key)
        NO-OP
        Specified by:
        contains in interface org.alfresco.repo.cache.SimpleCache<K extends java.io.Serializable,​V>
      • getKeys

        public java.util.Collection<K> getKeys()
        Specified by:
        getKeys in interface org.alfresco.repo.cache.SimpleCache<K extends java.io.Serializable,​V>
      • get

        public V get​(K key)
        NO-OP
        Specified by:
        get in interface org.alfresco.repo.cache.SimpleCache<K extends java.io.Serializable,​V>
      • put

        public void put​(K key,
                        V value)
        NO-OP
        Specified by:
        put in interface org.alfresco.repo.cache.SimpleCache<K extends java.io.Serializable,​V>
      • remove

        public void remove​(K key)
        NO-OP
        Specified by:
        remove in interface org.alfresco.repo.cache.SimpleCache<K extends java.io.Serializable,​V>
      • clear

        public void clear()
        NO-OP
        Specified by:
        clear in interface org.alfresco.repo.cache.SimpleCache<K extends java.io.Serializable,​V>