|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hazelcast.cache.HazelcastExpiryPolicy
public class HazelcastExpiryPolicy
Hazelcast provides overloads of the typical cache operations with a custom
ExpiryPolicy
parameter.
This class provides a custom implementation of an ExpiryPolicy
to
react on all three types of policies:
Sample usage:
ICache<Key, Value> unwrappedCache = cache.unwrap( ICache.class ); HazelcastExpiryPolicy customExpiry = new HazelcastExpiryPolicy(20, 30, 40, TimeUnit.SECONDS); unwrappedCache.put("key1", value, customExpiry );
Constructor Summary | |
---|---|
HazelcastExpiryPolicy(javax.cache.expiry.Duration create,
javax.cache.expiry.Duration access,
javax.cache.expiry.Duration update)
Constructs an expiry policy with provided values for creation, access and update by providing instances of the Duration class. |
|
HazelcastExpiryPolicy(javax.cache.expiry.ExpiryPolicy expiryPolicy)
Copy Constructor for an already existing ExpiryPolicy . |
|
HazelcastExpiryPolicy(long createMillis,
long accessMillis,
long updateMillis)
Constructs an expiry policy with provided values for creation, access and update in milliseconds. |
|
HazelcastExpiryPolicy(long createDurationAmount,
long accessDurationAmount,
long updateDurationAmount,
TimeUnit timeUnit)
Constructs an expiry policy with provided values for creation, access and update as well as a TimeUnit to convert those values to internally used time unites. |
Method Summary | |
---|---|
javax.cache.expiry.Duration |
getExpiryForAccess()
|
javax.cache.expiry.Duration |
getExpiryForCreation()
|
javax.cache.expiry.Duration |
getExpiryForUpdate()
|
int |
getFactoryId()
Returns DataSerializableFactory factory id for this class. |
int |
getId()
Returns type identifier for this class. |
void |
readData(ObjectDataInput in)
Reads fields from the input stream |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HazelcastExpiryPolicy(long createMillis, long accessMillis, long updateMillis)
createMillis
- expiry time in milliseconds after creationaccessMillis
- expiry time in milliseconds after last accessupdateMillis
- expiry time in milliseconds after last updatepublic HazelcastExpiryPolicy(long createDurationAmount, long accessDurationAmount, long updateDurationAmount, TimeUnit timeUnit)
TimeUnit
to convert those values to internally used time unites.
createDurationAmount
- expiry time after creationaccessDurationAmount
- expiry time after last accessupdateDurationAmount
- expiry time after last updatetimeUnit
- time unit of the previous value parameterspublic HazelcastExpiryPolicy(javax.cache.expiry.ExpiryPolicy expiryPolicy)
ExpiryPolicy
. Values are
copied to the internal state as is.
expiryPolicy
- expiry policy to copypublic HazelcastExpiryPolicy(javax.cache.expiry.Duration create, javax.cache.expiry.Duration access, javax.cache.expiry.Duration update)
Duration
class.
create
- expiry duration after creationaccess
- expiry duration after last accessupdate
- expiry duration after last updateMethod Detail |
---|
public javax.cache.expiry.Duration getExpiryForCreation()
getExpiryForCreation
in interface javax.cache.expiry.ExpiryPolicy
public javax.cache.expiry.Duration getExpiryForAccess()
getExpiryForAccess
in interface javax.cache.expiry.ExpiryPolicy
public javax.cache.expiry.Duration getExpiryForUpdate()
getExpiryForUpdate
in interface javax.cache.expiry.ExpiryPolicy
public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getId()
IdentifiedDataSerializable
getId
in interface IdentifiedDataSerializable
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- output
IOException
public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- input
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |