Usage
|
Method
|
Description
|
---|---|---|
Get instance
|
public static final RCache getInstance()
|
RCache applies the singleton pattern, you should get the single instance of it by using @return RCache.
|
Pull data
|
abstract public Object pullData(DataElement de, String key) throws ClassNotFoundException, DSEInvalidArgumentException, IOException
|
Pulls the data element (de) from the remote cache by using the key (key).
Returns the data element, or null if no data element is retrieved.
|
public Object pullData(DataElement de) throws ClassNotFoundException, DSEInvalidArgumentException, IOException
|
Pulls the data element (de) from the remote cache by using key=de.getName()
Returns the data element, or null if no data element is retrieved.
|
|
Push data
|
abstract public String pushData(DataElement de, String key) throws IOException
|
Pushes the data element (de) to the remote cache by using the key (key).
Returns the status code.
|
public String pushData(DataElement de) throws IOException
|
Pushes the data element (de) to the remote cache by using key=de.getName().
Returns the status code.
|
|
Drop data
|
abstract public boolean dropData(DataElement... des)
|
Drops the data element (des).
Returns true if successful, or false if failed.
|
abstract public boolean dropData(String... key)
|
Drops the data element by using the key (key).
Returns true if successful, or false if failed.
|
|
Lock
|
abstract public boolean lock(String rscName, long expired)
|
Creates a lock for the resource (rscName) with an expiry time in milliseconds (expired). If the lock is still in place after the expiry time, the lock is released.
Returns true if successful, or false if failed. No retries.
|
public boolean lock(String rscName)
|
Creates a lock for the resource (rscName) with the default expiry time (10 seconds). If the lock is still in place after the expiry time, the lock is released.
Returns true if successful, or false if failed. No retries.
|
|
Lock (with retry)
|
public boolean tryToLock(String rscName, long expired, long times)
|
Attempts to create a lock for the resource (rscName) with an expiry time in milliseconds (expired). If unsuccessful, retries the specified number of times (times). If the lock is still in place after the expiry time, the lock is released.
Returns true if successful, or false if failed (after retries).
|
public boolean tryToLock(String rscName, long times)
|
Attempts to create a lock for the resource (rscName) with the default expiry time (10 seconds). If unsuccessful, retries the specified number of times (times). If the lock is still in place after the expiry time, the lock is released.
Returns true if successful, or false if failed (after retries).
|
|
Unlock
|
abstract public boolean unlock(String rscName)
|
Unlocks resource (rscName).
Returns true if successful, or false if failed.
|
Release
|
public static final boolean close()
|
Releases the system resource that is used by this module. You must implement doClose() in your extension.
Returns true if successful, or false if failed.
|