Class Expiration (2.0.0)

public final class Expiration

Expiration specifications on MemcacheService#putAll(Map , Expiration) and MemcacheService#put(Object, Object, Expiration) operations.

Expiration has resolution to one second, although a milliseconds factory constructor is provided for convenience.

Inheritance

Object > Expiration

Static Methods

byDeltaMillis(int milliDelay)

public static Expiration byDeltaMillis(int milliDelay)

Creates an Expiration for some number of milliseconds into the future.

Parameter
NameDescription
milliDelayint

amount of time, in milliseconds, after which an item must be discarded from the cache.

Returns
TypeDescription
Expiration

a new Expiration representing the requested time.

byDeltaSeconds(int secondsDelay)

public static Expiration byDeltaSeconds(int secondsDelay)

Creates an Expiration for some number of seconds in the future.

Parameter
NameDescription
secondsDelayint

number of seconds after which an item must be discarded.

Returns
TypeDescription
Expiration

a new Expiration for the requested time.

onDate(Date expirationTime)

public static Expiration onDate(Date expirationTime)

Creates an expiration at specific date/time.

Parameter
NameDescription
expirationTimeDate

date/time after which an item must be discarded from the cache.

Returns
TypeDescription
Expiration

a new Expiration object representing the given Date.

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getMillisecondsValue()

public long getMillisecondsValue()

Fetches the expiration date, in milliseconds-since-epoch.

Returns
TypeDescription
long

timestamp of expiration, even if constructed via a delta rather than fixed date.

getSecondsValue()

public int getSecondsValue()

Fetches the expiration date, in seconds-since-epoch.

Returns
TypeDescription
int

timestamp of expiration, even if constructed via a delta rather than fixed date.

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides