blob: ad06d9a3e1d208437f8d3ed130ba028ef4e99b92 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: MemoryStore</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: MemoryStore</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="memory.html">store/memory</a>~</span>
MemoryStore
</h2>
<div class="class-description">MemoryStore</div>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="MemoryStore"><span class="type-signature"></span>new MemoryStore<span class="signature">(name)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Constructor for store objects that use a sorted array as the underlying mechanism.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Store name.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line35">line 35</a>
</li></ul></dd>
</dl>
</dd>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<dt>
<h4 class="name" id="mechanism"><span class="type-signature"></span>mechanism<span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Identifies the underlying mechanism used by the store.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line243">line 243</a>
</li></ul></dd>
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="add"><span class="type-signature"></span>add<span class="signature">(key, value, success, error)</span><span class="type-signature"></span></h4>
<p class="summary">Adds a new value identified by a key to the store.</p>
</dt>
<dd>
<div class="description">
This method errors out if the store already contains the specified key.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Key string.</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
</td>
<td class="description last">Value that is going to be added to the store.</td>
</tr>
<tr>
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Callback for a successful add operation.</td>
</tr>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Callback for handling errors. If not specified then store.defaultError is invoked.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line71">line 71</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addOrUpdate"><span class="type-signature"></span>addOrUpdate<span class="signature">(key, value, success, <span class="optional">error</span>)</span><span class="type-signature"></span></h4>
<p class="summary">Adds or updates a value identified by a key to the store.</p>
</dt>
<dd>
<div class="description">
This method will overwrite the key's current value if it already exists in the store; otherwise it simply adds the new key and value.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">Key string.</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="description last">Value that is going to be added or updated to the store.</td>
</tr>
<tr>
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last">Callback for a successful add or update operation.</td>
</tr>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">Callback for handling errors. If not specified then store.defaultError is invoked.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line91">line 91</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="clear"><span class="type-signature"></span>clear<span class="signature">(success)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Removes all the data associated with this store object.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Callback for a successful clear operation.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line118">line 118</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="close"><span class="type-signature"></span>close<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
This function does nothing in MemoryStore as it does not have a connection model.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line236">line 236</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="contains"><span class="type-signature"></span>contains<span class="signature">(key, success)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Checks whether a key exists in the store.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Key string.</td>
</tr>
<tr>
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Callback indicating whether the store contains the key or not.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line129">line 129</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getAllKeys"><span class="type-signature"></span>getAllKeys<span class="signature">(success)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Gets all the keys that exist in the store.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Callback for a successful get operation.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line139">line 139</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="read"><span class="type-signature"></span>read<span class="signature">(key, success, error)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Reads the value associated to a key in the store.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Key string.</td>
</tr>
<tr>
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Callback for a successful reads operation.</td>
</tr>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Callback for handling errors. If not specified then store.defaultError is invoked.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line152">line 152</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">(key, success, <span class="optional">error</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Removes a key and its value from the store.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">Key string.</td>
</tr>
<tr>
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last">Callback for a successful remove operation.</td>
</tr>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">Callback for handling errors. If not specified then store.defaultError is invoked.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line167">line 167</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">(key, value, success, <span class="optional">error</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Updates the value associated to a key in the store.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">Key string.</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
</td>
<td class="attributes">
</td>
<td class="description last">New value.</td>
</tr>
<tr>
<td class="name"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="description last">Callback for a successful update operation.</td>
</tr>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">Callback for handling errors. If not specified then store.defaultError is invoked. This method errors out if the specified key is not found in the store.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line197">line 197</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="validateKeyInput"><span class="type-signature">&lt;inner> </span>validateKeyInput<span class="signature">(key, error)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
</dt>
<dd>
<div class="description">
Validates that the specified key is not undefined, not null, and not an array
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
</td>
<td class="description last">Key value.</td>
</tr>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Error callback.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="memory.js.html">store/memory.js</a>, <a href="memory.js.html#line52">line 52</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if the key is valid. False if the key is invalid and the error callback has been queued for execution.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils.html">odata/utils</a></li><li><a href="deferred.html">odatajs/deferred</a></li><li><a href="utils_.html">odatajs/utils</a></li><li><a href="xml.html">odatajs/xml</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a href="DjsDeferred.html">DjsDeferred</a></li><li><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Thu Apr 09 2015 08:31:27 GMT+0200 (MESZ)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>