Class BackgroundCache<K,​V,​Ex extends Throwable>

  • Type Parameters:
    Ex - An arbitrary exception type that may be thrown

    public class BackgroundCache<K,​V,​Ex extends Throwable>
    extends Object

    A cache that is refreshed in the background, implementing only get, put, and size. There is no remove; background cleaning is performed on the underlying map.

    When the system is sitting idle, all cache entries are expired and there is zero overhead. Background refreshes only happen on recently used keys.

    Author:
    AO Industries, Inc.
    • Constructor Detail

      • BackgroundCache

        public BackgroundCache​(String name,
                               Class<? extends Ex> exceptionClass,
                               long refreshInterval,
                               long expirationAge,
                               Logger logger)
        Parameters:
        name - The name resources are based on, such as background thread names.
        exceptionClass - The class object used to verify exception types are runtime
        refreshInterval - The time between cache entry refreshes
        expirationAge - The time the a cache entry will expire if it has not been accessed, the actual expiration may happen after this time as it is only checked during refreshes.