Class InMemoryCache

java.lang.Object
org.silverpeas.kernel.cache.model.AbstractSimpleCache
org.silverpeas.kernel.cache.service.InMemoryCache
All Implemented Interfaces:
SimpleCache

public class InMemoryCache extends AbstractSimpleCache
Cache with which the data are stored in memory.
  • Constructor Details

    • InMemoryCache

      public InMemoryCache()
  • Method Details

    • getAll

      public Map<Object,Object> getAll()
      Gets the cache.
      Specified by:
      getAll in class AbstractSimpleCache
      Returns:
      the underlying cache used for its implementation.
    • clear

      public void clear()
      Description copied from interface: SimpleCache
      Clear the content of the cache.
    • get

      public Object get(Object key)
      Description copied from interface: SimpleCache
      Gets an element from the cache.
      Parameters:
      key - the key with which the object to get is mapped in the cache.
      Returns:
      the object mapped with the key or null if no there is no object mapped with the specified key.
    • remove

      public Object remove(Object key)
      Description copied from interface: SimpleCache
      Removes an element from the cache and return it.
      Parameters:
      key - the key with which the object to get is mapped in the cache.
      Returns:
      the object removed from the cache.
    • remove

      public <T> T remove(Object key, Class<T> classType)
      Description copied from interface: SimpleCache
      Removes a typed element from the cache and return it. Null is returned if an element exists for the given key but the object type doesn't correspond.
      Type Parameters:
      T - the concrete type of the object to remove.
      Parameters:
      key - the key with which the object to get is mapped in the cache.
      classType - the class of the instance to remove.
      Returns:
      the object removed from the cache.
    • put

      public void put(Object key, Object value)
      Description copied from interface: SimpleCache
      Puts a value for a given key. After 12 hours without be used the value is trashed.
      Parameters:
      key - the key with which the object to put has to be mapped
      value - the object to put in the cache.