The goog.storage.mechanism.IterableMechanism Class

goog.storage.mechanism.IterableMechanism
> goog.storage.mechanism.Mechanism

goog.storage.mechanism.IterableMechanism()

Interface for all iterable storage mechanisms.

.__iterator__(opt_keys)

Returns an iterator that iterates over the elements in the storage. Will throw goog.iter.StopIteration after the last element.

opt_keys {boolean=}
True to iterate over the keys. False to iterate over the values. The default value is false.
returns {!goog.iter.Iterator}
The iterator.

.clear()

Remove all key-value pairs. Could be overridden in a subclass, as the default implementation is not very efficient - it iterates over all keys.

.get(key)

Inherited from goog.storage.mechanism.Mechanism .

Get the value stored under a key.

key {string}
The key to get.
returns {?string}
The corresponding value, null if not found.

.getCount()

Get the number of stored key-value pairs. Could be overridden in a subclass, as the default implementation is not very efficient - it iterates over all keys.

returns {number}
Number of stored elements.

.remove(key)

Inherited from goog.storage.mechanism.Mechanism .

Remove a key and its value.

key {string}
The key to remove.

.set(key, value)

Inherited from goog.storage.mechanism.Mechanism .

Set a value for a key.

key {string}
The key to set.
value {string}
The string to save.