# Class Expiration (5.0.3)

    public final class Expiration

Expiration specifications on [MemcacheService#putAll(Map , Expiration)](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheService#com_google_appengine_api_memcache_MemcacheService_putAll_)
and [MemcacheService#put(Object, Object, Expiration)](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.MemcacheService#com_google_appengine_api_memcache_MemcacheService_put_java_lang_Object_java_lang_Object_com_google_appengine_api_memcache_Expiration_) operations.


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

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> Expiration

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## 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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` amount of time, in milliseconds, after which an item must be discarded from the cache. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` number of seconds after which an item must be discarded. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.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` | `https://docs.oracle.com/javase/8/docs/api/java/util/Date.html` date/time after which an item must be discarded from the cache. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.memcache.Expiration` | a new `Expiration` object representing the given [Date](https://docs.oracle.com/javase/8/docs/api/java/util/Date.html). |

## Methods

### equals(Object obj)

    public boolean equals(Object obj)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `obj` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)

### getMillisecondsValue()

    public long getMillisecondsValue()

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | 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** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | timestamp of expiration, even if constructed via a delta rather than fixed date. |

### hashCode()

    public int hashCode()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)