org.openjena.atlas.lib
Class CacheFactory

java.lang.Object
  extended by org.openjena.atlas.lib.CacheFactory

public class CacheFactory
extends Object


Constructor Summary
CacheFactory()
           
 
Method Summary
static
<Key,Value>
Cache<Key,Value>
createCache(float loadFactor, int maxSize)
          Create a cache which has space for up to a certain number of objects.
static
<Key,Value>
Cache<Key,Value>
createCache(Getter<Key,Value> getter, int maxSize)
          Create a cache which has space for upto a certain number of objects.
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>
createCacheUnbounded()
          Create a cache which has unbounded space
static
<Key,Value>
Cache<Key,Value>
createCacheWithGetter(Cache<Key,Value> cache, Getter<Key,Value> getter)
           
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
<Key,Value>
CacheStats<Key,Value>
createStats(Cache<Key,Value> cache)
          Add a statistics wrapper to an existing cache
static
<Key,Value>
Cache<Key,Value>
createSync(Cache<Key,Value> cache)
          Add a synchronization wrapper to an existing cache
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.


createCache

public static <Key,Value> Cache<Key,Value> createCache(float loadFactor,
                                                       int maxSize)
Create a cache which has space for up to a certain number of objects. The cache has an explicit loadfactor. The cache returns null for a cache miss.


createCache

public static <Key,Value> Cache<Key,Value> createCache(Getter<Key,Value> getter,
                                                       int maxSize)
Create a cache which has space for upto a certain number of objects. Call the getter when the cache has a miss.


createNullCache

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


createCacheUnbounded

public static <Key,Value> Cache<Key,Value> createCacheUnbounded()
Create a cache which has unbounded space


createCacheWithGetter

public static <Key,Value> Cache<Key,Value> createCacheWithGetter(Cache<Key,Value> cache,
                                                                 Getter<Key,Value> getter)

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


createStats

public static <Key,Value> CacheStats<Key,Value> createStats(Cache<Key,Value> cache)
Add a statistics wrapper to an existing cache


createSync

public static <Key,Value> Cache<Key,Value> createSync(Cache<Key,Value> cache)
Add a synchronization wrapper to an existing cache


createCacheSet

public static <Obj> CacheSet<Obj> createCacheSet(int size)
Create set-cache, rather than a map-cache.

See Also:
Pool

createSync

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



Licenced under the Apache License, Version 2.0