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
Name Description
milliDelay int

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

Returns
Type Description
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
Name Description
secondsDelay int

number of seconds after which an item must be discarded.

Returns
Type Description
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
Name Description
expirationTime Date

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

Returns
Type Description
Expiration

a new Expiration object representing the given Date.

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getMillisecondsValue()

public long getMillisecondsValue()

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

Returns
Type Description
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
Type Description
int

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

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides