Package org.idempiere.distributed
Interface ICacheService
public interface ICacheService
Interface for distributed cache service
-
Method Summary
Modifier and TypeMethodDescriptionvoidbroadcastReset(String tableName, int recordId) Broadcast a cache invalidation for the given table and integer record key to all cluster nodes.voidbroadcastReset(String tableName, String key) Broadcast a cache invalidation for the given table and string key to all cluster nodes.<K> List<K>Get list for distributed cache<K,V> Map<K, V> Get map for distributed cache<K> Set<K>Get set for distributed cache<K,V> boolean Tries to acquire the lock for a specified key.
If the lock is not available, then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens - the lock is acquired by the current thread, or the specified waiting time elapses.<K,V> void Releases the lock for the specified key.
-
Method Details
-
getMap
Get map for distributed cache- Type Parameters:
K-V-- Parameters:
name-- Returns:
- map for distributed cache
-
getList
Get list for distributed cache- Type Parameters:
K-- Parameters:
name-- Returns:
- list for distributed cache
-
getSet
Get set for distributed cache- Type Parameters:
K-- Parameters:
name-- Returns:
- set for distributed cache
-
tryLock
<K,V> boolean tryLock(Map<K, V> map, K key, long timeout, TimeUnit timeunit) throws InterruptedExceptionTries to acquire the lock for a specified key.
If the lock is not available, then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens - the lock is acquired by the current thread, or the specified waiting time elapses.- Parameters:
map-key-timeout-timeunit-- Returns:
- true if lock is acquired, false otherwise
- Throws:
InterruptedException
-
unLock
Releases the lock for the specified key. It never blocks and returns immediately.
If the current thread is the holder of this lock, then the hold count is decremented.
If the hold count is zero, then the lock is released.
If the current thread is not the holder of this lock, then IllegalMonitorStateException is thrown.- Parameters:
map-key-
-
broadcastReset
Broadcast a cache invalidation for the given table and integer record key to all cluster nodes. Fire-and-forget: does NOT wait for acknowledgement. Each receiving node calls its localresetLocalCache(tableName, recordId)on receipt.Intentionally abstract: implementations must provide this, otherwise cache invalidation would silently not propagate in a cluster environment.
- Parameters:
tableName- table whose cache must be invalidatedrecordId- record key; -1 invalidates all entries for the table
-
broadcastReset
Broadcast a cache invalidation for the given table and string key to all cluster nodes. Fire-and-forget: does NOT wait for acknowledgement.- Parameters:
tableName- table whose cache must be invalidatedkey- string cache key; empty string invalidates all entries for the table
-