StrongCacheStorage (FreeMarker 2.3.23 API)
Date: 2015-07-05

freemarker.cache

## Class StrongCacheStorage

- java.lang.Object
- - freemarker.cache.StrongCacheStorage

- All Implemented Interfaces:
    CacheStorage, CacheStorageWithGetSize, ConcurrentCacheStorage

      public class StrongCacheStorage
      extends Object
      implements ConcurrentCacheStorage, CacheStorageWithGetSize

  Strong cache storage is a cache storage that simply wraps a `Map`. It holds a strong reference to all objects it was passed, therefore prevents the cache from being purged during garbage collection. This class is thread-safe to the extent that its underlying map is. The default implementation uses a concurrent map on Java 5 and above, so it's thread-safe in that case.
  See Also:
    `Configuration.setCacheStorage(CacheStorage)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StrongCacheStorage()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `Object` | `get(Object key)`
    `int` | `getSize()` Returns a close approximation of the number of cache entries.
    `boolean` | `isConcurrent()` Returns true if the underlying Map is a `ConcurrentMap`.
    `void` | `put(Object key, Object value)`
    `void` | `remove(Object key)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StrongCacheStorage

          public StrongCacheStorage()

  - ### Method Detail

    - #### isConcurrent

          public boolean isConcurrent()

      Returns true if the underlying Map is a `ConcurrentMap`.
      Specified by:
        `isConcurrent` in interface `ConcurrentCacheStorage`
      Returns:
        true if this instance of cache storage is concurrently accessible from multiple threads without synchronization.

    - #### get

          public Object get(Object key)

      Specified by:
        `get` in interface `CacheStorage`

    - #### put

          public void put(Object key,
                          Object value)

      Specified by:
        `put` in interface `CacheStorage`

    - #### remove

          public void remove(Object key)

      Specified by:
        `remove` in interface `CacheStorage`

    - #### getSize

          public int getSize()

      Returns a close approximation of the number of cache entries.
      Specified by:
        `getSize` in interface `CacheStorageWithGetSize`
      Since:
        2.3.21

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `CacheStorage`