Yahoo! UI Library

Storage  2.9.0

Yahoo! UI Library > Storage > YAHOO.util.Storage
Search:
 
Filters

Class YAHOO.util.Storage

The Storage class is an HTML 5 storage API clone, used to wrap individual storage implementations with a common API.

Constructor

YAHOO.util.Storage ( sLocation , oConf )
Parameters:
sLocation <String> Required. The storage location.
oConf <Object> Required. A configuration object.

Properties

_cfg - protected {Object}

The configuration of the engine.

_location - protected {String}

The location for this instance.

_name - protected {String}

The name of this engine.

CE_CHANGE - {String}

The event name for when the storage item has changed.

CE_READY - {String}

The event name for when the storage item is ready.

isReady - protected {String}

This engine singleton has been initialized already.

length - {Number}

The current length of the keys.

Methods

_clear

protected void _clear ( )
Implementation of the clear login; should be overwritten by storage engine.

_createValue

protected void _createValue ( o )
Converts the object into a string, with meta data (type), so it can be restored later.
Parameters:
o <Object> Required. An object to store.

_getItem

protected String|NULL _getItem ( sKey )
Implementation of the getItem login; should be overwritten by storage engine.
Parameters:
sKey <String> Required. The key used to reference this value.
Returns: String|NULL
The value stored at the provided key.

_getValue

protected void _getValue ( s )
Converts the stored value into its appropriate type.
Parameters:
s <String> Required. The stored value.

_key

protected String|NULL _key ( nIndex )
Implementation of the key logic; should be overwritten by storage engine.
Parameters:
nIndex <Number> Required. The index to retrieve (unsigned long in HTML 5 spec).
Returns: String|NULL
Required. The key at the provided index (DOMString in HTML 5 spec).

_removeItem

protected void _removeItem ( sKey )
Implementation of the removeItem login; should be overwritten by storage engine.
Parameters:
sKey <String> Required. The key to remove.

_setItem

protected Boolean _setItem ( sKey , oData )
Implementation of the setItem login; should be overwritten by storage engine.
Parameters:
sKey <String> Required. The key used to reference this value.
oData <Object> Required. The data to storage at key.
Returns: Boolean
True when successful, false when size QUOTA exceeded.

clear

void clear ( )
Clears any existing key/value pairs.

getItem

String|NULL getItem ( sKey )
Fetches the data stored and the provided key.
Parameters:
sKey <String> Required. The key used to reference this value (DOMString in HTML 5 spec).
Returns: String|NULL
The value stored at the provided key (DOMString in HTML 5 spec).

getName

String getName ( )
Fetches the storage object's name; should be overwritten by storage engine.
Returns: String
The name of the data storage object.

hasKey

Boolean hasKey ( sKey )
Tests if the key has been set (not in HTML 5 spec); should be overwritten by storage engine.
Parameters:
sKey <String> Required. The key to search for.
Returns: Boolean
True when key has been set.

key

String key ( nIndex )
Retrieve the key stored at the provided index; should be overwritten by storage engine.
Parameters:
nIndex <Number> Required. The index to retrieve (unsigned long in HTML 5 spec).
Returns: String
Required. The key at the provided index (DOMString in HTML 5 spec).

removeItem

void removeItem ( sKey )
Remove an item from the data storage.
Parameters:
sKey <String> Required. The key to remove (DOMString in HTML 5 spec).

setItem

void setItem ( sKey , oData )
Adds an item to the data storage.
Parameters:
sKey <String> Required. The key used to reference this value (DOMString in HTML 5 spec).
oData <Object> Required. The data to store at key (DOMString in HTML 5 spec).


Copyright © 2011 Yahoo! Inc. All rights reserved.