</pre></div></td></tr><trid="section-3"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-3">¶</a></div><p>Suppress errors from the Redis client</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">redis</span><spanclass="p">.</span><spanclass="nx">on</span><spanclass="p">(</span><spanclass="s1">'error'</span><spanclass="p">,</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="p">};</span></pre></div></td></tr><trid="section-4"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-4">¶</a></div><h3>function get (key, callback)</h3>
<h4>@key {string} Key to retrieve for this instance.</h4>
<h4>@callback {function} Continuation to respond to when complete.</h4>
<p>Retrieves the value for the specified key (if any).</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Redis</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">get</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
</pre></div></td></tr><trid="section-5"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-5">¶</a></div><p>Set the callback if not provided for "fire and forget"</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">callback</span><spanclass="o">=</span><spanclass="nx">callback</span><spanclass="o">||</span><spanclass="kd">function</span><spanclass="p">()</span><spanclass="p">{</span><spanclass="p">};</span>
</pre></div></td></tr><trid="section-6"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-6">¶</a></div><p>If the key exists in the cache and the ttl is less than
the value set for this instance, return from the cache.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">if</span><spanclass="p">(</span><spanclass="nx">mtime</span><spanclass="o">&&</span><spanclass="nx">now</span><spanclass="o">-</span><spanclass="nx">mtime</span><spanclass="o"><</span><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">ttl</span><spanclass="p">)</span><spanclass="p">{</span>
</pre></div></td></tr><trid="section-7"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-7">¶</a></div><p>Get the set of all children keys for the <code>key</code> supplied. If the value
to be returned is an Object, this list will not be empty.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">redis</span><spanclass="p">.</span><spanclass="nx">smembers</span><spanclass="p">(</span><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">key</span><spanclass="p">(</span><spanclass="nx">fullKey</span><spanclass="p">,</span><spanclass="s1">'keys'</span><spanclass="p">),</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">,</span><spanclass="nx">keys</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="k">if</span><spanclass="p">(</span><spanclass="nx">keys</span><spanclass="o">&&</span><spanclass="nx">keys</span><spanclass="p">.</span><spanclass="nx">length</span><spanclass="o">></span><spanclass="mi">0</span><spanclass="p">)</span><spanclass="p">{</span></pre></div></td></tr><trid="section-8"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-8">¶</a></div><p>If the value to be retrieved is an Object, recursively attempt
to get the value from redis. Here we use a recursive call to <code>this.get</code>
to support nested Object keys.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">async</span><spanclass="p">.</span><spanclass="nx">forEach</span><spanclass="p">(</span><spanclass="nx">keys</span><spanclass="p">,</span><spanclass="nx">addValue</span><spanclass="p">,</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="k">else</span><spanclass="p">{</span></pre></div></td></tr><trid="section-9"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-9">¶</a></div><p>If there are no keys, then the value to be retrieved is a literal
and we can simply return the value from redis directly. </p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">self</span><spanclass="p">.</span><spanclass="nx">redis</span><spanclass="p">.</span><spanclass="nx">get</span><spanclass="p">(</span><spanclass="nx">fullKey</span><spanclass="p">,</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">,</span><spanclass="nx">value</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="p">};</span></pre></div></td></tr><trid="section-10"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-10">¶</a></div><h3>function set (key, value, callback)</h3>
<h4>@key {string} Key to set in this instance</h4>
<h4>@value {literal|Object} Value for the specified key</h4>
<h4>@callback {function} Continuation to respond to when complete.</h4>
<p>Sets the <code>value</code> for the specified <code>key</code> in this instance.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Redis</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">set</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">value</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
</pre></div></td></tr><trid="section-11"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-11">¶</a></div><p>Set the callback if not provided for "fire and forget"</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">callback</span><spanclass="o">=</span><spanclass="nx">callback</span><spanclass="o">||</span><spanclass="kd">function</span><spanclass="p">()</span><spanclass="p">{</span><spanclass="p">};</span>
<spanclass="k">if</span><spanclass="p">(</span><spanclass="o">!</span><spanclass="nb">Array</span><spanclass="p">.</span><spanclass="nx">isArray</span><spanclass="p">(</span><spanclass="nx">value</span><spanclass="p">)</span><spanclass="o">&&</span><spanclass="nx">value</span><spanclass="o">!==</span><spanclass="kc">null</span><spanclass="o">&&</span><spanclass="k">typeof</span><spanclass="nx">value</span><spanclass="o">===</span><spanclass="s1">'object'</span><spanclass="p">)</span><spanclass="p">{</span></pre></div></td></tr><trid="section-12"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-12">¶</a></div><p>If the value is an <code>Object</code> (and not an <code>Array</code>) then
member of that Object, the entire Object need not be retrieved). </p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">self</span><spanclass="p">.</span><spanclass="nx">cache</span><spanclass="p">.</span><spanclass="nx">set</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">value</span><spanclass="p">);</span>
<spanclass="k">else</span><spanclass="p">{</span></pre></div></td></tr><trid="section-13"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-13">¶</a></div><p>If the value is a simple literal (or an <code>Array</code>) then JSON
stringify it and put it into Redis.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">self</span><spanclass="p">.</span><spanclass="nx">cache</span><spanclass="p">.</span><spanclass="nx">set</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">value</span><spanclass="p">);</span>
<h4>@key {string} Key to merge the value into</h4>
<h4>@value {literal|Object} Value to merge into the key</h4>
<h4>2callback {function} Continuation to respond to when complete.</h4>
<p>Merges the properties in <code>value</code> into the existing object value
at <code>key</code>. If the existing value <code>key</code> is not an Object, it will be
completely overwritten.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Redis</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">merge</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">value</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span></pre></div></td></tr><trid="section-15"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-15">¶</a></div><p>If the key is not an <code>Object</code> or is an <code>Array</code>,
then simply set it. Merging is for Objects.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">if</span><spanclass="p">(</span><spanclass="k">typeof</span><spanclass="nx">value</span><spanclass="o">!==</span><spanclass="s1">'object'</span><spanclass="o">||</span><spanclass="nb">Array</span><spanclass="p">.</span><spanclass="nx">isArray</span><spanclass="p">(</span><spanclass="nx">value</span><spanclass="p">))</span><spanclass="p">{</span>
</pre></div></td></tr><trid="section-16"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-16">¶</a></div><p>Set the callback if not provided for "fire and forget"</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">callback</span><spanclass="o">=</span><spanclass="nx">callback</span><spanclass="o">||</span><spanclass="kd">function</span><spanclass="p">()</span><spanclass="p">{</span><spanclass="p">};</span>
</pre></div></td></tr><trid="section-17"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-17">¶</a></div><p>Get the set of all children keys for the <code>key</code> supplied. If the value
to be returned is an Object, this list will not be empty.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">_addKeys</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="k">if</span><spanclass="p">(</span><spanclass="nx">keys</span><spanclass="o">&&</span><spanclass="nx">keys</span><spanclass="p">.</span><spanclass="nx">length</span><spanclass="o">></span><spanclass="mi">0</span><spanclass="p">)</span><spanclass="p">{</span></pre></div></td></tr><trid="section-18"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-18">¶</a></div><p>If there are existing keys then we must do a recursive merge
of the two Objects.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">return</span><spanclass="nx">async</span><spanclass="p">.</span><spanclass="nx">forEach</span><spanclass="p">(</span><spanclass="nb">Object</span><spanclass="p">.</span><spanclass="nx">keys</span><spanclass="p">(</span><spanclass="nx">value</span><spanclass="p">),</span><spanclass="nx">nextMerge</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">);</span>
<spanclass="p">}</span></pre></div></td></tr><trid="section-19"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-19">¶</a></div><p>Otherwise, we can simply invoke <code>set</code> to override the current
literal or Array value with our new Object value</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">self</span><spanclass="p">.</span><spanclass="nx">set</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">value</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">);</span>
<h4>@key {string} Key to remove from this instance</h4>
<h4>@callback {function} Continuation to respond to when complete.</h4>
<p>Removes the value for the specified <code>key</code> from this instance.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Redis</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">clear</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="nx">fullKey</span><spanclass="o">=</span><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">key</span><spanclass="p">(</span><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">namespace</span><spanclass="p">,</span><spanclass="nx">key</span><spanclass="p">);</span></pre></div></td></tr><trid="section-21"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-21">¶</a></div><p>Set the callback if not provided for "fire and forget"</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">callback</span><spanclass="o">=</span><spanclass="nx">callback</span><spanclass="o">||</span><spanclass="kd">function</span><spanclass="p">()</span><spanclass="p">{</span><spanclass="p">};</span></pre></div></td></tr><trid="section-22"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-22">¶</a></div><p>Clear the key from the cache for this instance</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">cache</span><spanclass="p">.</span><spanclass="nx">clear</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">);</span>
</pre></div></td></tr><trid="section-23"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-23">¶</a></div><p>Remove the <code>key</code> from the parent set of keys.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">redis</span><spanclass="p">.</span><spanclass="nx">srem</span><spanclass="p">(</span><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">key</span><spanclass="p">.</span><spanclass="nx">apply</span><spanclass="p">(</span><spanclass="kc">null</span><spanclass="p">,</span><spanclass="nx">path</span><spanclass="p">.</span><spanclass="nx">concat</span><spanclass="p">([</span><spanclass="s1">'keys'</span><spanclass="p">])),</span><spanclass="nx">last</span><spanclass="p">,</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">)</span><spanclass="p">{</span></pre></div></td></tr><trid="section-24"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-24">¶</a></div><p>Remove the value from redis by iterating over the set of keys (if any)
and deleting each value. If no keys, then just delete the simple literal.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">self</span><spanclass="p">.</span><spanclass="nx">redis</span><spanclass="p">.</span><spanclass="nx">smembers</span><spanclass="p">(</span><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">key</span><spanclass="p">(</span><spanclass="nx">fullKey</span><spanclass="p">,</span><spanclass="s1">'keys'</span><spanclass="p">),</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">,</span><spanclass="nx">keys</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="kd">function</span><spanclass="nx">removeValue</span><spanclass="p">(</span><spanclass="nx">child</span><spanclass="p">,</span><spanclass="nx">next</span><spanclass="p">)</span><spanclass="p">{</span></pre></div></td></tr><trid="section-25"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-25">¶</a></div><p>Recursively call <code>self.clear</code> here to ensure we remove any
nested Objects completely from this instance.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">self</span><spanclass="p">.</span><spanclass="nx">clear</span><spanclass="p">(</span><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">key</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">child</span><spanclass="p">),</span><spanclass="nx">next</span><spanclass="p">);</span>
<spanclass="k">if</span><spanclass="p">(</span><spanclass="nx">keys</span><spanclass="o">&&</span><spanclass="nx">keys</span><spanclass="p">.</span><spanclass="nx">length</span><spanclass="o">></span><spanclass="mi">0</span><spanclass="p">)</span><spanclass="p">{</span></pre></div></td></tr><trid="section-26"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-26">¶</a></div><p>If there are child keys then iterate over them,
removing each child along the way.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">async</span><spanclass="p">.</span><spanclass="nx">forEach</span><spanclass="p">(</span><spanclass="nx">keys</span><spanclass="p">,</span><spanclass="nx">removeValue</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">);</span>
<spanclass="k">else</span><spanclass="p">{</span></pre></div></td></tr><trid="section-27"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-27">¶</a></div><p>Otherwise if this is just a simple literal, then
simply remove it from Redis directly.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">self</span><spanclass="p">.</span><spanclass="nx">redis</span><spanclass="p">.</span><spanclass="nx">del</span><spanclass="p">(</span><spanclass="nx">fullKey</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">);</span>
<spanclass="p">};</span></pre></div></td></tr><trid="section-28"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-28">¶</a></div><h3>function save (value, callback)</h3>
<h4>@value {Object} Config object to set for this instance</h4>
<h4>@callback {function} Continuation to respond to when complete.</h4>
<p>Removes any existing configuration settings that may exist in this
instance and then adds all key-value pairs in <code>value</code>. </p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Redis</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">save</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">value</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="k">return</span><spanclass="nx">callback</span><spanclass="p">(</span><spanclass="k">new</span><spanclass="nb">Error</span><spanclass="p">(</span><spanclass="s1">'`value` to be saved must be an object.'</span><spanclass="p">));</span>
</pre></div></td></tr><trid="section-29"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-29">¶</a></div><p>Set the callback if not provided for "fire and forget"</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">callback</span><spanclass="o">=</span><spanclass="nx">callback</span><spanclass="o">||</span><spanclass="kd">function</span><spanclass="p">()</span><spanclass="p">{</span><spanclass="p">};</span></pre></div></td></tr><trid="section-30"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-30">¶</a></div><p>Clear all existing keys associated with this instance.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">reset</span><spanclass="p">(</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">)</span><spanclass="p">{</span>
</pre></div></td></tr><trid="section-31"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-31">¶</a></div><p>Iterate over the keys in the new value, setting each of them.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">async</span><spanclass="p">.</span><spanclass="nx">forEach</span><spanclass="p">(</span><spanclass="nx">keys</span><spanclass="p">,</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">next</span><spanclass="p">)</span><spanclass="p">{</span>
<h4>@callback {function} Continuation to respond to when complete.</h4>
<p>Responds with an Object representing all keys associated in this instance.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Redis</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">load</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
</pre></div></td></tr><trid="section-33"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-33">¶</a></div><p>Set the callback if not provided for "fire and forget"</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">callback</span><spanclass="o">=</span><spanclass="nx">callback</span><spanclass="o">||</span><spanclass="kd">function</span><spanclass="p">()</span><spanclass="p">{</span><spanclass="p">};</span>
<h4>@callback {function} Continuation to respond to when complete.</h4>
<p>Clears all keys associated with this instance.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Redis</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">reset</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
</pre></div></td></tr><trid="section-35"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-35">¶</a></div><p>Set the callback if not provided for "fire and forget"</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">callback</span><spanclass="o">=</span><spanclass="nx">callback</span><spanclass="o">||</span><spanclass="kd">function</span><spanclass="p">()</span><spanclass="p">{</span><spanclass="p">};</span>
</pre></div></td></tr><trid="section-36"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-36">¶</a></div><p>Get the list of of top-level keys, then clear each of them</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">redis</span><spanclass="p">.</span><spanclass="nx">smembers</span><spanclass="p">(</span><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">key</span><spanclass="p">(</span><spanclass="k">this</span><spanclass="p">.</span><spanclass="nx">namespace</span><spanclass="p">,</span><spanclass="s1">'keys'</span><spanclass="p">),</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">,</span><spanclass="nx">existing</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="p">};</span></pre></div></td></tr><trid="section-37"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-37">¶</a></div><h3>@private function _addKeys (key, callback)</h3>
<h4>@key {string} Key to add parent keys for</h4>
<h4>@callback {function} Continuation to respond to when complete.</h4>
<p>Adds the full <code>key</code> path to Redis via <code>sadd</code>.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Redis</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">_addKeys</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="p">};</span></pre></div></td></tr><trid="section-38"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-38">¶</a></div><p>Iterate over the entire key path and add each key to the
parent key-set if it doesn't exist already.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">async</span><spanclass="p">.</span><spanclass="nx">forEach</span><spanclass="p">(</span><spanclass="nx">path</span><spanclass="p">,</span><spanclass="nx">addKey</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">);</span>
<spanclass="p">};</span></pre></div></td></tr><trid="section-39"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-39">¶</a></div><h3>@private function _setObject (key, value, callback)</h3>
<h4>@key {string} Key to set in this instance</h4>
<h4>@value {Object} Value for the specified key</h4>
<h4>@callback {function} Continuation to respond to when complete.</h4>
<p>Internal helper function for setting all keys of a nested object.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">Redis</span><spanclass="p">.</span><spanclass="nx">prototype</span><spanclass="p">.</span><spanclass="nx">_setObject</span><spanclass="o">=</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="nx">value</span><spanclass="p">,</span><spanclass="nx">callback</span><spanclass="p">)</span><spanclass="p">{</span>
<spanclass="kd">function</span><spanclass="nx">addValue</span><spanclass="p">(</span><spanclass="nx">child</span><spanclass="p">,</span><spanclass="nx">next</span><spanclass="p">)</span><spanclass="p">{</span></pre></div></td></tr><trid="section-40"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-40">¶</a></div><p>Add the child key to the parent key-set, then set the value.
Recursively call <code>_setObject</code> in the event of nested Object(s).</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">self</span><spanclass="p">.</span><spanclass="nx">redis</span><spanclass="p">.</span><spanclass="nx">sadd</span><spanclass="p">(</span><spanclass="nx">nconf</span><spanclass="p">.</span><spanclass="nx">key</span><spanclass="p">(</span><spanclass="nx">key</span><spanclass="p">,</span><spanclass="s1">'keys'</span><spanclass="p">),</span><spanclass="nx">child</span><spanclass="p">,</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">)</span><spanclass="p">{</span>
</pre></div></td></tr><trid="section-41"><tdclass="docs"><divclass="pilwrap"><aclass="pilcrow"href="#section-41">¶</a></div><p>Iterate over the keys of the Object and set the appropriate values.</p></td><tdclass="code"><divclass="highlight"><pre><spanclass="nx">async</span><spanclass="p">.</span><spanclass="nx">forEach</span><spanclass="p">(</span><spanclass="nx">keys</span><spanclass="p">,</span><spanclass="nx">addValue</span><spanclass="p">,</span><spanclass="kd">function</span><spanclass="p">(</span><spanclass="nx">err</span><spanclass="p">)</span><spanclass="p">{</span>