storage.ExpiringStorage Extends goog.storage.RichStorage
Provides a storage with expirning keys.

Inheritance

Constructor

goog.storage.ExpiringStorage(mechanism)

Parameters

mechanism : !goog.storage.mechanism.Mechanism
The underlying storage mechanism.

Instance Methods

Public Protected Private
getWrapper(keyopt_expired) ⇒ (!Object | undefined)
Get an item wrapper (the item and its metadata) from the storage.
Arguments:
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.
code »
set(keyvalueopt_expiration)
Set an item in the storage.
Arguments:
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.
code »
get()
No description.
code »
getWrapper(key) ⇒ (!Object | undefined)
Get an item wrapper (the item and its metadata) from the storage. WARNING: This returns an Object, which once used to be goog.storage.RichStorage.Wrapper. This is due to the fact that deserialized objects lose type information and it is hard to do proper typecasting in JavaScript. Be sure you know what you are doing when using the returned value.
Arguments:
key : string
The key to get.
Returns: (!Object | undefined)  The wrapper, or undefined if not found.
code »
set()
No description.
code »
get(key) *
Gets an item from the data storage.
Arguments:
key : string
The key to get.
Returns: *  Deserialized value or undefined if not found.
code »
remove(key)
Removes an item from the data storage.
Arguments:
key : string
The key to remove.
code »
set(keyvalue)
Sets an item in the data storage.
Arguments:
key : string
The key to set.
value : *
The value to serialize to a string and save.
code »

Instance Properties

constructor :
No description.
Code »
constructor :
No description.
Code »
The mechanism used to persist key-value pairs.
Code »

Static Methods

goog.storage.ExpiringStorage.getCreationTime(wrapper) number | undefined
Returns the wrapper creation time.
Arguments:
wrapper : !Object
The wrapper.
Returns: number | undefined  Wrapper creation time.
code »
goog.storage.ExpiringStorage.getExpirationTime(wrapper) number | undefined
Returns the wrapper expiration time.
Arguments:
wrapper : !Object
The wrapper.
Returns: number | undefined  Wrapper expiration time.
code »
goog.storage.ExpiringStorage.isExpired(wrapper) boolean
Checks if the data item has expired.
Arguments:
wrapper : !Object
The wrapper.
Returns: boolean  True if the item has expired.
code »

Static Properties

goog.storage.ExpiringStorage.CREATION_TIME_KEY :
Metadata key under which the creation time is stored.
Code »
goog.storage.ExpiringStorage.EXPIRATION_TIME_KEY :
Metadata key under which the expiration time is stored.
Code »
goog.storage.ExpiringStorage.superClass_ :
No description.
Code »

Package storage

Package Reference