Class CacheFactory


  • public class CacheFactory
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      CacheFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <Key,​Value>
      Cache<Key,​Value>
      createCache​(int maxSize)
      Create a cache which has space for up to a certain number of objects.
      static <Obj> CacheSet<Obj> createCacheSet​(int size)
      Create set-cache, rather than a map-cache.
      static <Key,​Value>
      Cache<Key,​Value>
      createNullCache()
      Create a null cache
      static <Key,​Value>
      Cache<Key,​Value>
      createOneSlotCache()
      One slot cache
      static <Key,​Value>
      Cache<Key,​Value>
      createSimpleCache​(int size)
      Create a lightweight cache (e.g.
      static <Obj> CacheSet<Obj> createSync​(CacheSet<Obj> cache)
      Add a synchronization wrapper to an existing set-cache
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CacheFactory

        public CacheFactory()
    • Method Detail

      • createCache

        public static <Key,​Value> Cache<Key,​Value> createCache​(int maxSize)
        Create a cache which has space for up to a certain number of objects. This is an LRU cache, or similar. The cache returns null for a cache miss. The cache is thread-safe for single operations.
      • createNullCache

        public static <Key,​Value> Cache<Key,​Value> createNullCache()
        Create a null cache
      • createSimpleCache

        public static <Key,​Value> Cache<Key,​Value> createSimpleCache​(int size)
        Create a lightweight cache (e.g. slot replacement)
      • createOneSlotCache

        public static <Key,​Value> Cache<Key,​Value> createOneSlotCache()
        One slot cache
      • createCacheSet

        public static <Obj> CacheSet<Obj> createCacheSet​(int size)
        Create set-cache, rather than a map-cache. The cache is thread-safe for single operations.
        See Also:
        Pool
      • createSync

        public static <Obj> CacheSet<Obj> createSync​(CacheSet<Obj> cache)
        Add a synchronization wrapper to an existing set-cache