elephas 2.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -365,7 +365,7 @@
365
365
  <li class="public ">
366
366
  <span class="summary_signature">
367
367
 
368
- <a href="#refresh-instance_method" title="#refresh (instance method)">- (Float) <strong>refresh</strong>(save = false) </a>
368
+ <a href="#refresh-instance_method" title="#refresh (instance method)">- (Float) <strong>refresh</strong>(save = false, cache = nil) </a>
369
369
 
370
370
 
371
371
 
@@ -388,7 +388,7 @@
388
388
  <li class="public ">
389
389
  <span class="summary_signature">
390
390
 
391
- <a href="#valid%3F-instance_method" title="#valid? (instance method)">- (Boolean) <strong>valid?</strong>(provider = nil) </a>
391
+ <a href="#valid%3F-instance_method" title="#valid? (instance method)">- (Boolean) <strong>valid?</strong>(backend) </a>
392
392
 
393
393
 
394
394
 
@@ -695,20 +695,20 @@
695
695
  <span class='comment'># Refreshes the entry.
696
696
  </span> <span class='comment'>#
697
697
  </span> <span class='comment'># @param save [Boolean] If to save the refresh value in the cache.
698
+ </span> <span class='comment'># @param cache [Cache] The cache where to save the entry.
698
699
  </span> <span class='comment'># @return [Float] The new updated_at value.
699
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
700
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_cache'>cache</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
700
701
  <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
701
- <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
702
+ <span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_cache'>cache</span>
702
703
  <span class='ivar'>@updated_at</span>
703
704
  <span class='kw'>end</span>
704
705
 
705
706
  <span class='comment'># Checks if the entry is still valid.
706
707
  </span> <span class='comment'>#
707
- </span> <span class='comment'># @param provider [Provider::Base] The provider to use for the check.
708
+ </span> <span class='comment'># @param backend [Backends::Base] The backend to use for the check.
708
709
  </span> <span class='comment'># @return [Boolean] `true` if the entry is still valid, `false` otherwise.
709
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_provider'>provider</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
710
- <span class='id identifier rubyid_provider'>provider</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span>
711
- <span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
710
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_backend'>backend</span><span class='rparen'>)</span>
711
+ <span class='id identifier rubyid_backend'>backend</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
712
712
  <span class='kw'>end</span>
713
713
 
714
714
  <span class='comment'># Compares to another Entry.
@@ -924,20 +924,20 @@
924
924
  <span class='comment'># Refreshes the entry.
925
925
  </span> <span class='comment'>#
926
926
  </span> <span class='comment'># @param save [Boolean] If to save the refresh value in the cache.
927
+ </span> <span class='comment'># @param cache [Cache] The cache where to save the entry.
927
928
  </span> <span class='comment'># @return [Float] The new updated_at value.
928
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
929
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_cache'>cache</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
929
930
  <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
930
- <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
931
+ <span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_cache'>cache</span>
931
932
  <span class='ivar'>@updated_at</span>
932
933
  <span class='kw'>end</span>
933
934
 
934
935
  <span class='comment'># Checks if the entry is still valid.
935
936
  </span> <span class='comment'>#
936
- </span> <span class='comment'># @param provider [Provider::Base] The provider to use for the check.
937
+ </span> <span class='comment'># @param backend [Backends::Base] The backend to use for the check.
937
938
  </span> <span class='comment'># @return [Boolean] `true` if the entry is still valid, `false` otherwise.
938
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_provider'>provider</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
939
- <span class='id identifier rubyid_provider'>provider</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span>
940
- <span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
939
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_backend'>backend</span><span class='rparen'>)</span>
940
+ <span class='id identifier rubyid_backend'>backend</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
941
941
  <span class='kw'>end</span>
942
942
 
943
943
  <span class='comment'># Compares to another Entry.
@@ -1153,20 +1153,20 @@
1153
1153
  <span class='comment'># Refreshes the entry.
1154
1154
  </span> <span class='comment'>#
1155
1155
  </span> <span class='comment'># @param save [Boolean] If to save the refresh value in the cache.
1156
+ </span> <span class='comment'># @param cache [Cache] The cache where to save the entry.
1156
1157
  </span> <span class='comment'># @return [Float] The new updated_at value.
1157
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
1158
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_cache'>cache</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1158
1159
  <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
1159
- <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
1160
+ <span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_cache'>cache</span>
1160
1161
  <span class='ivar'>@updated_at</span>
1161
1162
  <span class='kw'>end</span>
1162
1163
 
1163
1164
  <span class='comment'># Checks if the entry is still valid.
1164
1165
  </span> <span class='comment'>#
1165
- </span> <span class='comment'># @param provider [Provider::Base] The provider to use for the check.
1166
+ </span> <span class='comment'># @param backend [Backends::Base] The backend to use for the check.
1166
1167
  </span> <span class='comment'># @return [Boolean] `true` if the entry is still valid, `false` otherwise.
1167
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_provider'>provider</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1168
- <span class='id identifier rubyid_provider'>provider</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span>
1169
- <span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
1168
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_backend'>backend</span><span class='rparen'>)</span>
1169
+ <span class='id identifier rubyid_backend'>backend</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
1170
1170
  <span class='kw'>end</span>
1171
1171
 
1172
1172
  <span class='comment'># Compares to another Entry.
@@ -1382,20 +1382,20 @@
1382
1382
  <span class='comment'># Refreshes the entry.
1383
1383
  </span> <span class='comment'>#
1384
1384
  </span> <span class='comment'># @param save [Boolean] If to save the refresh value in the cache.
1385
+ </span> <span class='comment'># @param cache [Cache] The cache where to save the entry.
1385
1386
  </span> <span class='comment'># @return [Float] The new updated_at value.
1386
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
1387
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_cache'>cache</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1387
1388
  <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
1388
- <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
1389
+ <span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_cache'>cache</span>
1389
1390
  <span class='ivar'>@updated_at</span>
1390
1391
  <span class='kw'>end</span>
1391
1392
 
1392
1393
  <span class='comment'># Checks if the entry is still valid.
1393
1394
  </span> <span class='comment'>#
1394
- </span> <span class='comment'># @param provider [Provider::Base] The provider to use for the check.
1395
+ </span> <span class='comment'># @param backend [Backends::Base] The backend to use for the check.
1395
1396
  </span> <span class='comment'># @return [Boolean] `true` if the entry is still valid, `false` otherwise.
1396
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_provider'>provider</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1397
- <span class='id identifier rubyid_provider'>provider</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span>
1398
- <span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
1397
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_backend'>backend</span><span class='rparen'>)</span>
1398
+ <span class='id identifier rubyid_backend'>backend</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
1399
1399
  <span class='kw'>end</span>
1400
1400
 
1401
1401
  <span class='comment'># Compares to another Entry.
@@ -1611,20 +1611,20 @@
1611
1611
  <span class='comment'># Refreshes the entry.
1612
1612
  </span> <span class='comment'>#
1613
1613
  </span> <span class='comment'># @param save [Boolean] If to save the refresh value in the cache.
1614
+ </span> <span class='comment'># @param cache [Cache] The cache where to save the entry.
1614
1615
  </span> <span class='comment'># @return [Float] The new updated_at value.
1615
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
1616
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_cache'>cache</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1616
1617
  <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
1617
- <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
1618
+ <span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_cache'>cache</span>
1618
1619
  <span class='ivar'>@updated_at</span>
1619
1620
  <span class='kw'>end</span>
1620
1621
 
1621
1622
  <span class='comment'># Checks if the entry is still valid.
1622
1623
  </span> <span class='comment'>#
1623
- </span> <span class='comment'># @param provider [Provider::Base] The provider to use for the check.
1624
+ </span> <span class='comment'># @param backend [Backends::Base] The backend to use for the check.
1624
1625
  </span> <span class='comment'># @return [Boolean] `true` if the entry is still valid, `false` otherwise.
1625
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_provider'>provider</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1626
- <span class='id identifier rubyid_provider'>provider</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span>
1627
- <span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
1626
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_backend'>backend</span><span class='rparen'>)</span>
1627
+ <span class='id identifier rubyid_backend'>backend</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
1628
1628
  <span class='kw'>end</span>
1629
1629
 
1630
1630
  <span class='comment'># Compares to another Entry.
@@ -1978,7 +1978,7 @@
1978
1978
  <div class="method_details ">
1979
1979
  <h3 class="signature " id="refresh-instance_method">
1980
1980
 
1981
- - (<tt>Float</tt>) <strong>refresh</strong>(save = false)
1981
+ - (<tt>Float</tt>) <strong>refresh</strong>(save = false, cache = nil)
1982
1982
 
1983
1983
 
1984
1984
 
@@ -2012,6 +2012,23 @@
2012
2012
 
2013
2013
  </li>
2014
2014
 
2015
+ <li>
2016
+
2017
+ <span class='name'>cache</span>
2018
+
2019
+
2020
+ <span class='type'>(<tt><span class='object_link'><a href="Cache.html" title="Elephas::Cache (class)">Cache</a></span></tt>)</span>
2021
+
2022
+
2023
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
2024
+
2025
+
2026
+ &mdash;
2027
+ <div class='inline'><p>The cache where to save the entry.</p>
2028
+ </div>
2029
+
2030
+ </li>
2031
+
2015
2032
  </ul>
2016
2033
 
2017
2034
  <p class="tag_title">Returns:</p>
@@ -2038,18 +2055,18 @@
2038
2055
  <pre class="lines">
2039
2056
 
2040
2057
 
2041
- 45
2042
2058
  46
2043
2059
  47
2044
2060
  48
2045
- 49</pre>
2061
+ 49
2062
+ 50</pre>
2046
2063
  </td>
2047
2064
  <td>
2048
- <pre class="code"><span class="info file"># File 'lib/elephas/entry.rb', line 45</span>
2065
+ <pre class="code"><span class="info file"># File 'lib/elephas/entry.rb', line 46</span>
2049
2066
 
2050
- <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
2067
+ <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_cache'>cache</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
2051
2068
  <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
2052
- <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
2069
+ <span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_cache'>cache</span>
2053
2070
  <span class='ivar'>@updated_at</span>
2054
2071
  <span class='kw'>end</span></pre>
2055
2072
  </td>
@@ -2060,7 +2077,7 @@
2060
2077
  <div class="method_details ">
2061
2078
  <h3 class="signature " id="valid?-instance_method">
2062
2079
 
2063
- - (<tt>Boolean</tt>) <strong>valid?</strong>(provider = nil)
2080
+ - (<tt>Boolean</tt>) <strong>valid?</strong>(backend)
2064
2081
 
2065
2082
 
2066
2083
 
@@ -2079,17 +2096,15 @@
2079
2096
 
2080
2097
  <li>
2081
2098
 
2082
- <span class='name'>provider</span>
2083
-
2099
+ <span class='name'>backend</span>
2084
2100
 
2085
- <span class='type'>(<tt>Provider::Base</tt>)</span>
2086
2101
 
2102
+ <span class='type'>(<tt><span class='object_link'><a href="Backends/Base.html" title="Elephas::Backends::Base (class)">Backends::Base</a></span></tt>)</span>
2087
2103
 
2088
- <em class="default">(defaults to: <tt>nil</tt>)</em>
2089
2104
 
2090
2105
 
2091
2106
  &mdash;
2092
- <div class='inline'><p>The provider to use for the check.</p>
2107
+ <div class='inline'><p>The backend to use for the check.</p>
2093
2108
  </div>
2094
2109
 
2095
2110
  </li>
@@ -2120,17 +2135,15 @@
2120
2135
  <pre class="lines">
2121
2136
 
2122
2137
 
2123
- 55
2124
2138
  56
2125
2139
  57
2126
2140
  58</pre>
2127
2141
  </td>
2128
2142
  <td>
2129
- <pre class="code"><span class="info file"># File 'lib/elephas/entry.rb', line 55</span>
2143
+ <pre class="code"><span class="info file"># File 'lib/elephas/entry.rb', line 56</span>
2130
2144
 
2131
- <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_provider'>provider</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
2132
- <span class='id identifier rubyid_provider'>provider</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span>
2133
- <span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
2145
+ <span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_backend'>backend</span><span class='rparen'>)</span>
2146
+ <span class='id identifier rubyid_backend'>backend</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>&lt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span> <span class='op'>/</span> <span class='int'>1000</span>
2134
2147
  <span class='kw'>end</span></pre>
2135
2148
  </td>
2136
2149
  </tr>
@@ -2142,7 +2155,7 @@
2142
2155
  </div>
2143
2156
 
2144
2157
  <div id="footer">
2145
- Generated on Thu Feb 28 10:48:18 2013 by
2158
+ Generated on Sun Mar 24 12:12:01 2013 by
2146
2159
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2147
2160
  0.8.5.2 (ruby-1.9.3).
2148
2161
  </div>
@@ -119,7 +119,7 @@
119
119
 
120
120
  </div>
121
121
  </dt>
122
- <dd><pre class="code"><span class='int'>2</span></pre></dd>
122
+ <dd><pre class="code"><span class='int'>3</span></pre></dd>
123
123
 
124
124
  <dt id="MINOR-constant" class="">MINOR =
125
125
  <div class="docstring">
@@ -134,7 +134,7 @@
134
134
 
135
135
  </div>
136
136
  </dt>
137
- <dd><pre class="code"><span class='int'>2</span></pre></dd>
137
+ <dd><pre class="code"><span class='int'>0</span></pre></dd>
138
138
 
139
139
  <dt id="PATCH-constant" class="">PATCH =
140
140
  <div class="docstring">
@@ -180,7 +180,7 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Thu Feb 28 10:48:17 2013 by
183
+ Generated on Sun Mar 24 12:12:01 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.5.2 (ruby-1.9.3).
186
186
  </div>
data/doc/Elephas.html CHANGED
@@ -80,7 +80,7 @@
80
80
 
81
81
  <dt class="r1 last">Defined in:</dt>
82
82
  <dd class="r1 last">lib/elephas/entry.rb<span class="defines">,<br />
83
- lib/elephas/cache.rb,<br /> lib/elephas/version.rb,<br /> lib/elephas/provider.rb,<br /> lib/elephas/providers/hash.rb,<br /> lib/elephas/providers/ruby_on_rails.rb</span>
83
+ lib/elephas/cache.rb,<br /> lib/elephas/version.rb,<br /> lib/elephas/backends/hash.rb,<br /> lib/elephas/backends/base.rb,<br /> lib/elephas/backends/ruby_on_rails.rb</span>
84
84
  </dd>
85
85
 
86
86
  </dl>
@@ -101,7 +101,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
101
101
  <p class="children">
102
102
 
103
103
 
104
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="Elephas/Providers.html" title="Elephas::Providers (module)">Providers</a></span>, <span class='object_link'><a href="Elephas/Version.html" title="Elephas::Version (module)">Version</a></span>
104
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Elephas/Backends.html" title="Elephas::Backends (module)">Backends</a></span>, <span class='object_link'><a href="Elephas/Version.html" title="Elephas::Version (module)">Version</a></span>
105
105
 
106
106
 
107
107
 
@@ -121,7 +121,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Thu Feb 28 10:48:17 2013 by
124
+ Generated on Sun Mar 24 12:12:01 2013 by
125
125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
126
  0.8.5.2 (ruby-1.9.3).
127
127
  </div>
data/doc/_index.html CHANGED
@@ -85,9 +85,16 @@
85
85
  <ul>
86
86
 
87
87
  <li>
88
- <span class='object_link'><a href="Elephas/Providers/Base.html" title="Elephas::Providers::Base (module)">Base</a></span>
88
+ <span class='object_link'><a href="Elephas/Backends.html" title="Elephas::Backends (module)">Backends</a></span>
89
89
 
90
- <small>(Elephas::Providers)</small>
90
+ <small>(Elephas)</small>
91
+
92
+ </li>
93
+
94
+ <li>
95
+ <span class='object_link'><a href="Elephas/Backends/Base.html" title="Elephas::Backends::Base (class)">Base</a></span>
96
+
97
+ <small>(Elephas::Backends)</small>
91
98
 
92
99
  </li>
93
100
 
@@ -135,24 +142,9 @@
135
142
  <ul>
136
143
 
137
144
  <li>
138
- <span class='object_link'><a href="Elephas/Providers/Hash.html" title="Elephas::Providers::Hash (class)">Hash</a></span>
139
-
140
- <small>(Elephas::Providers)</small>
141
-
142
- </li>
143
-
144
- </ul>
145
- </ul>
146
-
147
-
148
- <ul id="alpha_P" class="alpha">
149
- <li class="letter">P</li>
150
- <ul>
151
-
152
- <li>
153
- <span class='object_link'><a href="Elephas/Providers.html" title="Elephas::Providers (module)">Providers</a></span>
145
+ <span class='object_link'><a href="Elephas/Backends/Hash.html" title="Elephas::Backends::Hash (class)">Hash</a></span>
154
146
 
155
- <small>(Elephas)</small>
147
+ <small>(Elephas::Backends)</small>
156
148
 
157
149
  </li>
158
150
 
@@ -165,9 +157,9 @@
165
157
  <ul>
166
158
 
167
159
  <li>
168
- <span class='object_link'><a href="Elephas/Providers/RubyOnRails.html" title="Elephas::Providers::RubyOnRails (class)">RubyOnRails</a></span>
160
+ <span class='object_link'><a href="Elephas/Backends/RubyOnRails.html" title="Elephas::Backends::RubyOnRails (class)">RubyOnRails</a></span>
169
161
 
170
- <small>(Elephas::Providers)</small>
162
+ <small>(Elephas::Backends)</small>
171
163
 
172
164
  </li>
173
165
 
@@ -198,7 +190,7 @@
198
190
  </div>
199
191
 
200
192
  <div id="footer">
201
- Generated on Thu Feb 28 10:48:17 2013 by
193
+ Generated on Sun Mar 24 12:12:01 2013 by
202
194
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
203
195
  0.8.5.2 (ruby-1.9.3).
204
196
  </div>
data/doc/class_list.html CHANGED
@@ -45,7 +45,7 @@
45
45
 
46
46
  <ul id="full_list" class="class">
47
47
  <li><span class='object_link'><a href="top-level-namespace.html" title=" (root)">Top Level Namespace</a></span></li>
48
- <li><a class='toggle'></a> <span class='object_link'><a href="Elephas.html" title="Elephas (module)">Elephas</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Elephas/Cache.html" title="Elephas::Cache (class)">Cache</a></span> &lt; Object<small class='search_info'>Elephas</small></li><li><span class='object_link'><a href="Elephas/Entry.html" title="Elephas::Entry (class)">Entry</a></span> &lt; Object<small class='search_info'>Elephas</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Elephas/Providers.html" title="Elephas::Providers (module)">Providers</a></span><small class='search_info'>Elephas</small></li><ul><li><span class='object_link'><a href="Elephas/Providers/Base.html" title="Elephas::Providers::Base (module)">Base</a></span><small class='search_info'>Elephas::Providers</small></li><li><span class='object_link'><a href="Elephas/Providers/Hash.html" title="Elephas::Providers::Hash (class)">Hash</a></span> &lt; Object<small class='search_info'>Elephas::Providers</small></li><li><span class='object_link'><a href="Elephas/Providers/RubyOnRails.html" title="Elephas::Providers::RubyOnRails (class)">RubyOnRails</a></span> &lt; Object<small class='search_info'>Elephas::Providers</small></li></ul><li><span class='object_link'><a href="Elephas/Version.html" title="Elephas::Version (module)">Version</a></span><small class='search_info'>Elephas</small></li></ul>
48
+ <li><a class='toggle'></a> <span class='object_link'><a href="Elephas.html" title="Elephas (module)">Elephas</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><a class='toggle'></a> <span class='object_link'><a href="Elephas/Backends.html" title="Elephas::Backends (module)">Backends</a></span><small class='search_info'>Elephas</small></li><ul><li><span class='object_link'><a href="Elephas/Backends/Base.html" title="Elephas::Backends::Base (class)">Base</a></span> &lt; Object<small class='search_info'>Elephas::Backends</small></li><li><span class='object_link'><a href="Elephas/Backends/Hash.html" title="Elephas::Backends::Hash (class)">Hash</a></span> &lt; Base<small class='search_info'>Elephas::Backends</small></li><li><span class='object_link'><a href="Elephas/Backends/RubyOnRails.html" title="Elephas::Backends::RubyOnRails (class)">RubyOnRails</a></span> &lt; Base<small class='search_info'>Elephas::Backends</small></li></ul><li><span class='object_link'><a href="Elephas/Cache.html" title="Elephas::Cache (class)">Cache</a></span> &lt; Object<small class='search_info'>Elephas</small></li><li><span class='object_link'><a href="Elephas/Entry.html" title="Elephas::Entry (class)">Entry</a></span> &lt; Object<small class='search_info'>Elephas</small></li><li><span class='object_link'><a href="Elephas/Version.html" title="Elephas::Version (module)">Version</a></span><small class='search_info'>Elephas</small></li></ul>
49
49
 
50
50
  </ul>
51
51
  </div>
data/doc/file.README.html CHANGED
@@ -78,10 +78,10 @@
78
78
 
79
79
  <p>The usage of the framework is really simple.</p>
80
80
 
81
- <p>At first you have to setup a provider (that is, a storage) for the Elephas. By default it uses an internal hash, and also Rails is supported.</p>
81
+ <p>At first you have to setup a cache object with a backend (that is, a storage) for the Elephas. By default it uses an internal hash, and also Rails is supported.</p>
82
82
 
83
83
  <p><code>ruby
84
- Elephas::Cache.provider = Elephas::Providers::RubyOnRails.new
84
+ cache = Elephas::Cache.new(Elephas::Backends::RubyOnRails.new)
85
85
  </code></p>
86
86
 
87
87
  <p>After that, you can query the framework for a value use the <code>use</code> method.</p>
@@ -89,7 +89,7 @@ Elephas::Cache.provider = Elephas::Providers::RubyOnRails.new
89
89
  <p>You should also pass a block to the method, so that the framework use that for computing the value of the cache entry.</p>
90
90
 
91
91
  <p><code>ruby
92
- value = Elephas::Cache.use("KEY") do |options|
92
+ value = cache.use("KEY") do |options|
93
93
  "VALUE"
94
94
  end
95
95
  # =&gt; "VALUE"
@@ -99,7 +99,7 @@ end
99
99
 
100
100
  <p>The block takes an argument, which contains all the options for the entry.</p>
101
101
 
102
- <p>You can see <code>Elephas::Cache.setup_options</code> documentation to see what options are supported.</p>
102
+ <p>You can see <code>Elephas::Cache#setup_options</code> documentation to see what options are supported.</p>
103
103
 
104
104
  <p>For now, you just have to know that you can set the <code>:ttl</code> option to specify how long the value will stay in the cache (in milliseconds). Setting it to a non-positive value means to never cache the value.</p>
105
105
 
@@ -127,7 +127,7 @@ end
127
127
  </div></div>
128
128
 
129
129
  <div id="footer">
130
- Generated on Thu Feb 28 10:48:17 2013 by
130
+ Generated on Sun Mar 24 12:12:01 2013 by
131
131
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
132
132
  0.8.5.2 (ruby-1.9.3).
133
133
  </div>
data/doc/index.html CHANGED
@@ -78,10 +78,10 @@
78
78
 
79
79
  <p>The usage of the framework is really simple.</p>
80
80
 
81
- <p>At first you have to setup a provider (that is, a storage) for the Elephas. By default it uses an internal hash, and also Rails is supported.</p>
81
+ <p>At first you have to setup a cache object with a backend (that is, a storage) for the Elephas. By default it uses an internal hash, and also Rails is supported.</p>
82
82
 
83
83
  <p><code>ruby
84
- Elephas::Cache.provider = Elephas::Providers::RubyOnRails.new
84
+ cache = Elephas::Cache.new(Elephas::Backends::RubyOnRails.new)
85
85
  </code></p>
86
86
 
87
87
  <p>After that, you can query the framework for a value use the <code>use</code> method.</p>
@@ -89,7 +89,7 @@ Elephas::Cache.provider = Elephas::Providers::RubyOnRails.new
89
89
  <p>You should also pass a block to the method, so that the framework use that for computing the value of the cache entry.</p>
90
90
 
91
91
  <p><code>ruby
92
- value = Elephas::Cache.use("KEY") do |options|
92
+ value = cache.use("KEY") do |options|
93
93
  "VALUE"
94
94
  end
95
95
  # =&gt; "VALUE"
@@ -99,7 +99,7 @@ end
99
99
 
100
100
  <p>The block takes an argument, which contains all the options for the entry.</p>
101
101
 
102
- <p>You can see <code>Elephas::Cache.setup_options</code> documentation to see what options are supported.</p>
102
+ <p>You can see <code>Elephas::Cache#setup_options</code> documentation to see what options are supported.</p>
103
103
 
104
104
  <p>For now, you just have to know that you can set the <code>:ttl</code> option to specify how long the value will stay in the cache (in milliseconds). Setting it to a non-positive value means to never cache the value.</p>
105
105
 
@@ -127,7 +127,7 @@ end
127
127
  </div></div>
128
128
 
129
129
  <div id="footer">
130
- Generated on Thu Feb 28 10:48:17 2013 by
130
+ Generated on Sun Mar 24 12:12:01 2013 by
131
131
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
132
132
  0.8.5.2 (ruby-1.9.3).
133
133
  </div>