com.liferay.faces.util.cache
Class CacheFactory

java.lang.Object
  extended by com.liferay.faces.util.cache.CacheFactory
All Implemented Interfaces:
javax.faces.FacesWrapper<CacheFactory>

public abstract class CacheFactory
extends Object
implements javax.faces.FacesWrapper<CacheFactory>

Since:
3.1, 2.1, 1.1
Author:
Kyle Stiemann

Constructor Summary
CacheFactory()
           
 
Method Summary
abstract
<K,V> Cache<K,V>
getConcurrentCache(int initialCapacity)
          Returns a new instance of Cache.
static
<K,V> Cache<K,V>
getConcurrentCacheInstance(javax.faces.context.ExternalContext externalContext, int initialCapacity)
          Returns a new instance of Cache from the CacheFactory found by the FactoryExtensionFinder.
abstract
<K,V> Cache<K,V>
getConcurrentLRUCache(int initialCapacity, int maxCapacity)
          Returns a new instance of Cache.
static
<K,V> Cache<K,V>
getConcurrentLRUCacheInstance(javax.faces.context.ExternalContext externalContext, int initialCapacity, int maxCapacity)
          Returns a new instance of Cache from the CacheFactory found by the FactoryExtensionFinder.
abstract  CacheFactory getWrapped()
          Returns the wrapped factory instance if this factory decorates another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheFactory

public CacheFactory()
Method Detail

getConcurrentCacheInstance

public static <K,V> Cache<K,V> getConcurrentCacheInstance(javax.faces.context.ExternalContext externalContext,
                                                          int initialCapacity)
                                             throws IllegalArgumentException
Returns a new instance of Cache from the CacheFactory found by the FactoryExtensionFinder. The returned instance is designed to be accessed and modified by multiple threads concurrently, so it is guaranteed to be Serializable.

Type Parameters:
K - The type of the cache's keys.
V - The type of the cache's values.
Parameters:
externalContext - The external context associated with the current faces context.
initialCapacity - The initial capacity of the cache.
Throws:
IllegalArgumentException - if the initial capacity is less than zero.
See Also:
getConcurrentCache(int)

getConcurrentLRUCacheInstance

public static <K,V> Cache<K,V> getConcurrentLRUCacheInstance(javax.faces.context.ExternalContext externalContext,
                                                             int initialCapacity,
                                                             int maxCapacity)
                                                throws IllegalArgumentException
Returns a new instance of Cache from the CacheFactory found by the FactoryExtensionFinder. The returned instance is designed to be accessed and modified by multiple threads concurrently, so it is guaranteed to be Serializable. The returned cache will avoid exceeding the maximum cache capacity by using a least-recently-used algorithm which may cause a significant performance impact when compared to a cache that does not enforce a maximum size (for example, a cache returned from getConcurrentCache(int)).

Type Parameters:
K - The type of the cache's keys.
V - The type of the cache's values.
Parameters:
externalContext - The external context associated with the current faces context.
initialCapacity - The initial capacity of the cache.
maxCapacity - The maximum capacity of the cache.
Throws:
IllegalArgumentException - if the initial capacity is less than zero or the maximum capacity is less than 1.
See Also:
getConcurrentLRUCache(int, int)

getConcurrentCache

public abstract <K,V> Cache<K,V> getConcurrentCache(int initialCapacity)
                                       throws IllegalArgumentException
Returns a new instance of Cache. The returned instance is designed to be accessed and modified by multiple threads concurrently, so it is guaranteed to be Serializable.

Type Parameters:
K - The type of the cache's keys.
V - The type of the cache's values.
Parameters:
initialCapacity - The initial capacity of the cache.
Throws:
IllegalArgumentException - if the initial capacity is less than zero.

getConcurrentLRUCache

public abstract <K,V> Cache<K,V> getConcurrentLRUCache(int initialCapacity,
                                                       int maxCapacity)
                                          throws IllegalArgumentException
Returns a new instance of Cache. The returned instance is designed to be accessed and modified by multiple threads concurrently, so it is guaranteed to be Serializable. The returned cache will avoid exceeding the maximum cache capacity by using a least-recently-used algorithm which may cause a significant performance impact when compared to a cache that does not enforce a maximum size (for example, a cache returned from getConcurrentCache(int)).

Type Parameters:
K - The type of the cache's keys.
V - The type of the cache's values.
Parameters:
initialCapacity - The initial capacity of the cache.
maxCapacity - The maximum capacity of the cache.
Throws:
IllegalArgumentException - if the initial capacity is less than zero or the maximum capacity is less than 1.

getWrapped

public abstract CacheFactory getWrapped()
Returns the wrapped factory instance if this factory decorates another. Otherwise, this method returns null.

Specified by:
getWrapped in interface javax.faces.FacesWrapper<CacheFactory>


Copyright © 2019 Liferay, Inc.. All rights reserved.