com.liferay.faces.util.cache
Class CacheWrapper<K,V>

java.lang.Object
  extended by com.liferay.faces.util.cache.CacheWrapper<K,V>
All Implemented Interfaces:
Cache<K,V>, javax.faces.FacesWrapper<Cache<K,V>>

public abstract class CacheWrapper<K,V>
extends Object
implements Cache<K,V>, javax.faces.FacesWrapper<Cache<K,V>>

Author:
Kyle Stiemann

Constructor Summary
CacheWrapper()
           
 
Method Summary
 boolean containsKey(K key)
          Returns true if the key (and therefor a corresponding value) is present in the cache or false otherwise.
 Set<K> getKeys()
          Returns the set of all keys currently in the cache at the time this method was called.
 int getSize()
          Returns the number of key-value pairs in the cache.
 V getValue(K key)
          Returns the cached value that is mapped to this key or null if the value is not in the cache.
 V putValueIfAbsent(K key, V value)
          Puts the cached key-value pair into the cache if the key does not already exist in the cache.
 V removeValue(K key)
          Removes an entry from the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.FacesWrapper
getWrapped
 

Constructor Detail

CacheWrapper

public CacheWrapper()
Method Detail

containsKey

public boolean containsKey(K key)
Description copied from interface: Cache
Returns true if the key (and therefor a corresponding value) is present in the cache or false otherwise.

Specified by:
containsKey in interface Cache<K,V>
Parameters:
key - The key that the value is mapped to.
See Also:
Cache.containsKey(java.lang.Object)

getKeys

public Set<K> getKeys()
Description copied from interface: Cache
Returns the set of all keys currently in the cache at the time this method was called.

Specified by:
getKeys in interface Cache<K,V>
See Also:
Cache.getKeys()

getSize

public int getSize()
Description copied from interface: Cache
Returns the number of key-value pairs in the cache.

Specified by:
getSize in interface Cache<K,V>
See Also:
Cache.getSize()

getValue

public V getValue(K key)
Description copied from interface: Cache
Returns the cached value that is mapped to this key or null if the value is not in the cache.

Specified by:
getValue in interface Cache<K,V>
Parameters:
key - The key that the value is mapped to.
See Also:
Cache.getValue(java.lang.Object)

putValueIfAbsent

public V putValueIfAbsent(K key,
                          V value)
Description copied from interface: Cache
Puts the cached key-value pair into the cache if the key does not already exist in the cache. If the key was not already added to the cache, this method returns the passed value for convenience. Otherwise this method returns the value associated with the key from the cache.

Specified by:
putValueIfAbsent in interface Cache<K,V>
Parameters:
key - The key that the value is mapped to.
value - The value to be cached.
See Also:
Cache.putValueIfAbsent(java.lang.Object, java.lang.Object)

removeValue

public V removeValue(K key)
Description copied from interface: Cache
Removes an entry from the cache. Returns the value of the removed key-value pair.

Specified by:
removeValue in interface Cache<K,V>
Parameters:
key - The key that the value is mapped to.
See Also:
Cache.removeValue(java.lang.Object)


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