The goog.storage.ExpiringStorage Class

goog.storage.ExpiringStorage
> goog.storage.RichStorage
> goog.storage.Storage

goog.storage.ExpiringStorage(mechanism)

Provides a storage with expirning keys.

mechanism {!goog.storage.mechanism.Mechanism}
The underlying storage mechanism.

.get(key)

Inherited from goog.storage.RichStorage .

Get an item from the data storage.

key {string}
The key to get.
returns {*}
Deserialized value or undefined if not found.

.getCreationTime(wrapper)

Returns the wrapper creation time.

wrapper {!Object}
The wrapper.
returns {number|undefined}
Wrapper creation time.

.getExpirationTime(wrapper)

Returns the wrapper expiration time.

wrapper {!Object}
The wrapper.
returns {number|undefined}
Wrapper expiration time.

.getWrapper(key, opt_expired)

Get an item wrapper (the item and its metadata) from the storage.

key {string}
The key to get.
opt_expired {boolean=}
If true, return expired wrappers as well.
returns {(!Object|undefined)}
The wrapper, or undefined if not found.

.isExpired(wrapper)

Checks if the data item has expired.

wrapper {!Object}
The wrapper.
returns {boolean}
True if the item has expired.

.remove(key)

Inherited from goog.storage.Storage .

Remove an item from the data storage.

key {string}
The key to remove.

.set(key, value, opt_expiration)

Set an item in the storage.

key {string}
The key to set.
value {*}
The value to serialize to a string and save.
opt_expiration {number=}
The number of miliseconds since epoch (as in goog.now()) when the value is to expire. If the expiration time is not provided, the value will persist as long as possible.