Package org.idempiere.cache
Class POCopyCache<K,V extends PO>
java.lang.Object
org.compiere.util.CCache<K,V>
org.idempiere.cache.POCopyCache<K,V>
- All Implemented Interfaces:
Serializable
,Map<K,
,V> CacheInterface
- Direct Known Subclasses:
IntPOCopyCache
Thread safe PO cache using copy on read and copy on write strategy.
- Author:
- hengsin
- See Also:
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.compiere.util.CCache
cache, DEFAULT_EXPIRE_MINUTE, nullList
-
Constructor Summary
ConstructorDescriptionPOCopyCache
(String name, int initialCapacity) POCopyCache
(String name, int initialCapacity, int expireMinutes) POCopyCache
(String name, int initialCapacity, int expireMinutes, boolean distributed) POCopyCache
(String name, int initialCapacity, int expireMinutes, boolean distributed, int maxSize) POCopyCache
(String tableName, String name, int initialCapacity) POCopyCache
(String tableName, String name, int initialCapacity, boolean distributed) POCopyCache
(String tableName, String name, int initialCapacity, int expireMinutes, boolean distributed) POCopyCache
(String tableName, String name, int initialCapacity, int expireMinutes, boolean distributed, int maxSize) -
Method Summary
Modifier and TypeMethodDescriptionget
(Properties ctx, K key) Get a copy of PO from cache using copy constructorget
(Properties ctx, K key, String trxName) Get a copy of PO from cache using copy constructorget
(K key, UnaryOperator<V> copyOperator) Get PO from cache.Put valueput
(K key, V po, UnaryOperator<V> copyOperator) A copy of the PO will be created and add to cache using copyOperator or through copy constructor (through reflection) if copyOperator parameter is null (exception is throw if both copyOperator and copy constructor is not available).Methods inherited from class org.compiere.util.CCache
addVetoableChangeListener, clear, containsKey, containsValue, entrySet, getExpireMinutes, getHit, getMaxSize, getMiss, getName, getTableName, isDistributed, isEmpty, isExpire, isReset, keySet, newRecord, putAll, remove, removeVetoableChangeListener, reset, reset, setExpireMinutes, setUsed, size, sizeNoExpire, toString, values
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
POCopyCache
public POCopyCache(String name, int initialCapacity, int expireMinutes, boolean distributed, int maxSize) - Parameters:
name
-initialCapacity
-expireMinutes
-distributed
-maxSize
-
-
POCopyCache
- Parameters:
name
-initialCapacity
-expireMinutes
-distributed
-
-
POCopyCache
- Parameters:
name
-initialCapacity
-expireMinutes
-
-
POCopyCache
- Parameters:
name
-initialCapacity
-
-
POCopyCache
- Parameters:
tableName
-name
-initialCapacity
-distributed
-
-
POCopyCache
public POCopyCache(String tableName, String name, int initialCapacity, int expireMinutes, boolean distributed, int maxSize) - Parameters:
tableName
-name
-initialCapacity
-expireMinutes
-distributed
-maxSize
-
-
POCopyCache
public POCopyCache(String tableName, String name, int initialCapacity, int expireMinutes, boolean distributed) - Parameters:
tableName
-name
-initialCapacity
-expireMinutes
-distributed
-
-
POCopyCache
- Parameters:
tableName
-name
-initialCapacity
-
-
-
Method Details
-
put
Description copied from class:CCache
Put value -
put
A copy of the PO will be created and add to cache using copyOperator or through copy constructor (through reflection) if copyOperator parameter is null (exception is throw if both copyOperator and copy constructor is not available).- Parameters:
key
-po
-copyOperator
- operator to call copy constructor- Returns:
- PO added to cache
-
get
-
get
Get a copy of PO from cache using copy constructor- Parameters:
ctx
- contextkey
-- Returns:
- value for key
-
get
Get a copy of PO from cache using copy constructor- Parameters:
ctx
- contextkey
-trxName
-- Returns:
- value for key
-
get
Get PO from cache. A copy of the cached PO is return- Parameters:
key
-copyOperator
- operator to call copy constructor- Returns:
- copy of PO from cache (if there's match for key)
-