elephas 2.2.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -1
- data/README.md +4 -4
- data/doc/Elephas/{Providers → Backends}/Base.html +48 -38
- data/doc/Elephas/{Providers → Backends}/Hash.html +35 -38
- data/doc/Elephas/{Providers → Backends}/RubyOnRails.html +32 -35
- data/doc/Elephas/{Providers.html → Backends.html} +8 -10
- data/doc/Elephas/Cache.html +894 -111
- data/doc/Elephas/Entry.html +63 -50
- data/doc/Elephas/Version.html +3 -3
- data/doc/Elephas.html +3 -3
- data/doc/_index.html +14 -22
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +5 -5
- data/doc/index.html +5 -5
- data/doc/method_list.html +62 -54
- data/doc/top-level-namespace.html +1 -1
- data/elephas.gemspec +1 -1
- data/lib/elephas/{provider.rb → backends/base.rb} +4 -6
- data/lib/elephas/{providers → backends}/hash.rb +7 -7
- data/lib/elephas/{providers → backends}/ruby_on_rails.rb +4 -6
- data/lib/elephas/cache.rb +47 -29
- data/lib/elephas/entry.rb +6 -6
- data/lib/elephas/version.rb +2 -2
- data/lib/elephas.rb +4 -6
- data/locales/en.yml +1 -1
- data/locales/it.yml +1 -1
- data/spec/elephas/cache_spec.rb +32 -35
- data/spec/elephas/entry_spec.rb +6 -5
- data/spec/elephas/{provider_spec.rb → providers/base_spec.rb} +2 -6
- data/spec/elephas/providers/hash_spec.rb +6 -6
- data/spec/elephas/providers/ruby_on_rails_spec.rb +2 -2
- metadata +14 -14
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -15,10 +15,10 @@ http://rdoc.info/gems/elephas
|
|
15
15
|
|
16
16
|
The usage of the framework is really simple.
|
17
17
|
|
18
|
-
At first you have to setup a
|
18
|
+
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.
|
19
19
|
|
20
20
|
```ruby
|
21
|
-
Elephas::Cache.
|
21
|
+
cache = Elephas::Cache.new(Elephas::Backends::RubyOnRails.new)
|
22
22
|
```
|
23
23
|
|
24
24
|
After that, you can query the framework for a value use the `use` method.
|
@@ -26,7 +26,7 @@ After that, you can query the framework for a value use the `use` method.
|
|
26
26
|
You should also pass a block to the method, so that the framework use that for computing the value of the cache entry.
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
value =
|
29
|
+
value = cache.use("KEY") do |options|
|
30
30
|
"VALUE"
|
31
31
|
end
|
32
32
|
# => "VALUE"
|
@@ -36,7 +36,7 @@ The next time you issue this call, the block won't be called.
|
|
36
36
|
|
37
37
|
The block takes an argument, which contains all the options for the entry.
|
38
38
|
|
39
|
-
You can see ``Elephas::Cache
|
39
|
+
You can see ``Elephas::Cache#setup_options`` documentation to see what options are supported.
|
40
40
|
|
41
41
|
For now, you just have to know that you can set the ```:ttl``` 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.
|
42
42
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
6
|
<title>
|
7
|
-
|
7
|
+
Class: Elephas::Backends::Base
|
8
8
|
|
9
9
|
— Documentation by YARD 0.8.5.2
|
10
10
|
|
@@ -32,7 +32,7 @@
|
|
32
32
|
<div id="menu">
|
33
33
|
|
34
34
|
<a href="../../_index.html">Index (B)</a> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../../Elephas.html" title="Elephas (module)">Elephas</a></span></span> » <span class='title'><span class='object_link'><a href="../
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Elephas.html" title="Elephas (module)">Elephas</a></span></span> » <span class='title'><span class='object_link'><a href="../Backends.html" title="Elephas::Backends (module)">Backends</a></span></span>
|
36
36
|
»
|
37
37
|
<span class="title">Base</span>
|
38
38
|
|
@@ -63,7 +63,7 @@
|
|
63
63
|
|
64
64
|
<iframe id="search_frame"></iframe>
|
65
65
|
|
66
|
-
<div id="content"><h1>
|
66
|
+
<div id="content"><h1>Class: Elephas::Backends::Base
|
67
67
|
|
68
68
|
|
69
69
|
|
@@ -71,11 +71,22 @@
|
|
71
71
|
|
72
72
|
<dl class="box">
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
<
|
77
|
-
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Elephas::Backends::Base</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
78
85
|
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
79
90
|
|
80
91
|
|
81
92
|
|
@@ -85,20 +96,16 @@
|
|
85
96
|
|
86
97
|
|
87
98
|
|
88
|
-
<dt class="r1">Included in:</dt>
|
89
|
-
<dd class="r1"><span class='object_link'><a href="Hash.html" title="Elephas::Providers::Hash (class)">Hash</a></span>, <span class='object_link'><a href="RubyOnRails.html" title="Elephas::Providers::RubyOnRails (class)">RubyOnRails</a></span></dd>
|
90
|
-
|
91
|
-
|
92
99
|
|
93
|
-
<dt class="
|
94
|
-
<dd class="
|
100
|
+
<dt class="r1 last">Defined in:</dt>
|
101
|
+
<dd class="r1 last">lib/elephas/backends/base.rb</dd>
|
95
102
|
|
96
103
|
</dl>
|
97
104
|
<div class="clear"></div>
|
98
105
|
|
99
106
|
<h2>Overview</h2><div class="docstring">
|
100
107
|
<div class="discussion">
|
101
|
-
<p>The base
|
108
|
+
<p>The a base backend. All data-related methods must be overriden.</p>
|
102
109
|
|
103
110
|
|
104
111
|
</div>
|
@@ -106,6 +113,9 @@
|
|
106
113
|
<div class="tags">
|
107
114
|
|
108
115
|
|
116
|
+
</div><div id="subclasses">
|
117
|
+
<h2>Direct Known Subclasses</h2>
|
118
|
+
<p class="children"><span class='object_link'><a href="Hash.html" title="Elephas::Backends::Hash (class)">Hash</a></span>, <span class='object_link'><a href="RubyOnRails.html" title="Elephas::Backends::RubyOnRails (class)">RubyOnRails</a></span></p>
|
109
119
|
</div>
|
110
120
|
|
111
121
|
|
@@ -113,6 +123,7 @@
|
|
113
123
|
|
114
124
|
|
115
125
|
|
126
|
+
|
116
127
|
|
117
128
|
<h2>
|
118
129
|
Instance Method Summary
|
@@ -241,7 +252,6 @@
|
|
241
252
|
|
242
253
|
|
243
254
|
|
244
|
-
|
245
255
|
|
246
256
|
<div id="instance_method_details" class="method_details_list">
|
247
257
|
<h2>Instance Method Details</h2>
|
@@ -308,12 +318,12 @@
|
|
308
318
|
<pre class="lines">
|
309
319
|
|
310
320
|
|
311
|
-
|
312
|
-
|
313
|
-
|
321
|
+
37
|
322
|
+
38
|
323
|
+
39</pre>
|
314
324
|
</td>
|
315
325
|
<td>
|
316
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/
|
326
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/backends/base.rb', line 37</span>
|
317
327
|
|
318
328
|
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
319
329
|
<span class='id identifier rubyid_unimplemented'>unimplemented</span>
|
@@ -384,12 +394,12 @@
|
|
384
394
|
<pre class="lines">
|
385
395
|
|
386
396
|
|
387
|
-
|
388
|
-
|
389
|
-
|
397
|
+
45
|
398
|
+
46
|
399
|
+
47</pre>
|
390
400
|
</td>
|
391
401
|
<td>
|
392
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/
|
402
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/backends/base.rb', line 45</span>
|
393
403
|
|
394
404
|
<span class='kw'>def</span> <span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
395
405
|
<span class='id identifier rubyid_unimplemented'>unimplemented</span>
|
@@ -441,12 +451,12 @@
|
|
441
451
|
<pre class="lines">
|
442
452
|
|
443
453
|
|
444
|
-
|
445
|
-
|
446
|
-
|
454
|
+
52
|
455
|
+
53
|
456
|
+
54</pre>
|
447
457
|
</td>
|
448
458
|
<td>
|
449
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/
|
459
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/backends/base.rb', line 52</span>
|
450
460
|
|
451
461
|
<span class='kw'>def</span> <span class='id identifier rubyid_now'>now</span>
|
452
462
|
<span class='op'>::</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>
|
@@ -517,12 +527,12 @@
|
|
517
527
|
<pre class="lines">
|
518
528
|
|
519
529
|
|
520
|
-
|
521
|
-
|
522
|
-
|
530
|
+
18
|
531
|
+
19
|
532
|
+
20</pre>
|
523
533
|
</td>
|
524
534
|
<td>
|
525
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/
|
535
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/backends/base.rb', line 18</span>
|
526
536
|
|
527
537
|
<span class='kw'>def</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
528
538
|
<span class='id identifier rubyid_unimplemented'>unimplemented</span>
|
@@ -587,7 +597,7 @@
|
|
587
597
|
<span class='name'>options</span>
|
588
598
|
|
589
599
|
|
590
|
-
<span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Elephas::
|
600
|
+
<span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Elephas::Backends::Hash (class)">Hash</a></span></tt>)</span>
|
591
601
|
|
592
602
|
|
593
603
|
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
@@ -622,7 +632,7 @@
|
|
622
632
|
<p class="tag_title">See Also:</p>
|
623
633
|
<ul class="see">
|
624
634
|
|
625
|
-
<li
|
635
|
+
<li>Cache.setup_options</li>
|
626
636
|
|
627
637
|
</ul>
|
628
638
|
|
@@ -632,12 +642,12 @@
|
|
632
642
|
<pre class="lines">
|
633
643
|
|
634
644
|
|
635
|
-
|
636
|
-
|
637
|
-
|
645
|
+
29
|
646
|
+
30
|
647
|
+
31</pre>
|
638
648
|
</td>
|
639
649
|
<td>
|
640
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/
|
650
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/backends/base.rb', line 29</span>
|
641
651
|
|
642
652
|
<span class='kw'>def</span> <span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
643
653
|
<span class='id identifier rubyid_unimplemented'>unimplemented</span>
|
@@ -652,7 +662,7 @@
|
|
652
662
|
</div>
|
653
663
|
|
654
664
|
<div id="footer">
|
655
|
-
Generated on
|
665
|
+
Generated on Sun Mar 24 12:12:02 2013 by
|
656
666
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
657
667
|
0.8.5.2 (ruby-1.9.3).
|
658
668
|
</div>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
6
|
<title>
|
7
|
-
Class: Elephas::
|
7
|
+
Class: Elephas::Backends::Hash
|
8
8
|
|
9
9
|
— Documentation by YARD 0.8.5.2
|
10
10
|
|
@@ -32,7 +32,7 @@
|
|
32
32
|
<div id="menu">
|
33
33
|
|
34
34
|
<a href="../../_index.html">Index (H)</a> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../../Elephas.html" title="Elephas (module)">Elephas</a></span></span> » <span class='title'><span class='object_link'><a href="../
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Elephas.html" title="Elephas (module)">Elephas</a></span></span> » <span class='title'><span class='object_link'><a href="../Backends.html" title="Elephas::Backends (module)">Backends</a></span></span>
|
36
36
|
»
|
37
37
|
<span class="title">Hash</span>
|
38
38
|
|
@@ -63,7 +63,7 @@
|
|
63
63
|
|
64
64
|
<iframe id="search_frame"></iframe>
|
65
65
|
|
66
|
-
<div id="content"><h1>Class: Elephas::
|
66
|
+
<div id="content"><h1>Class: Elephas::Backends::Hash
|
67
67
|
|
68
68
|
|
69
69
|
|
@@ -73,12 +73,14 @@
|
|
73
73
|
|
74
74
|
<dt class="r1">Inherits:</dt>
|
75
75
|
<dd class="r1">
|
76
|
-
<span class="inheritName">
|
76
|
+
<span class="inheritName"><span class='object_link'><a href="Base.html" title="Elephas::Backends::Base (class)">Base</a></span></span>
|
77
77
|
|
78
78
|
<ul class="fullTree">
|
79
79
|
<li>Object</li>
|
80
80
|
|
81
|
-
<li class="next"
|
81
|
+
<li class="next"><span class='object_link'><a href="Base.html" title="Elephas::Backends::Base (class)">Base</a></span></li>
|
82
|
+
|
83
|
+
<li class="next">Elephas::Backends::Hash</li>
|
82
84
|
|
83
85
|
</ul>
|
84
86
|
<a href="#" class="inheritanceTree">show all</a>
|
@@ -90,22 +92,18 @@
|
|
90
92
|
|
91
93
|
|
92
94
|
|
93
|
-
<dt class="r2">Includes:</dt>
|
94
|
-
<dd class="r2"><span class='object_link'><a href="Base.html" title="Elephas::Providers::Base (module)">Base</a></span></dd>
|
95
|
-
|
96
|
-
|
97
95
|
|
98
96
|
|
99
97
|
|
100
|
-
<dt class="
|
101
|
-
<dd class="
|
98
|
+
<dt class="r2 last">Defined in:</dt>
|
99
|
+
<dd class="r2 last">lib/elephas/backends/hash.rb</dd>
|
102
100
|
|
103
101
|
</dl>
|
104
102
|
<div class="clear"></div>
|
105
103
|
|
106
104
|
<h2>Overview</h2><div class="docstring">
|
107
105
|
<div class="discussion">
|
108
|
-
<p>This is a simple
|
106
|
+
<p>This is a simple backend, which uses an hash for storing the values.</p>
|
109
107
|
|
110
108
|
|
111
109
|
</div>
|
@@ -140,7 +138,7 @@
|
|
140
138
|
|
141
139
|
|
142
140
|
|
143
|
-
<span class="summary_desc"><div class='inline'><p>The internal hash used by the
|
141
|
+
<span class="summary_desc"><div class='inline'><p>The internal hash used by the backend.</p>
|
144
142
|
</div></span>
|
145
143
|
|
146
144
|
</li>
|
@@ -224,7 +222,7 @@
|
|
224
222
|
|
225
223
|
|
226
224
|
|
227
|
-
<span class="summary_desc"><div class='inline'><p>Initialize the
|
225
|
+
<span class="summary_desc"><div class='inline'><p>Initialize the backend.</p>
|
228
226
|
</div></span>
|
229
227
|
|
230
228
|
</li>
|
@@ -288,17 +286,16 @@
|
|
288
286
|
|
289
287
|
|
290
288
|
|
291
|
-
<h3 class="inherited">Methods
|
292
|
-
<p class="inherited"><span class='object_link'><a href="Base.html#now-instance_method" title="Elephas::
|
289
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Base.html" title="Elephas::Backends::Base (class)">Base</a></span></h3>
|
290
|
+
<p class="inherited"><span class='object_link'><a href="Base.html#now-instance_method" title="Elephas::Backends::Base#now (method)">#now</a></span></p>
|
293
291
|
|
294
|
-
|
295
292
|
<div id="constructor_details" class="method_details_list">
|
296
293
|
<h2>Constructor Details</h2>
|
297
294
|
|
298
295
|
<div class="method_details first">
|
299
296
|
<h3 class="signature first" id="initialize-instance_method">
|
300
297
|
|
301
|
-
- (<tt><span class='object_link'><a href="" title="Elephas::
|
298
|
+
- (<tt><span class='object_link'><a href="" title="Elephas::Backends::Hash (class)">Hash</a></span></tt>) <strong>initialize</strong>(data = nil)
|
302
299
|
|
303
300
|
|
304
301
|
|
@@ -306,7 +303,7 @@
|
|
306
303
|
|
307
304
|
</h3><div class="docstring">
|
308
305
|
<div class="discussion">
|
309
|
-
<p>Initialize the
|
306
|
+
<p>Initialize the backend.</p>
|
310
307
|
|
311
308
|
|
312
309
|
</div>
|
@@ -320,7 +317,7 @@
|
|
320
317
|
<span class='name'>data</span>
|
321
318
|
|
322
319
|
|
323
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Elephas::
|
320
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Elephas::Backends::Hash (class)">Hash</a></span></tt>)</span>
|
324
321
|
|
325
322
|
|
326
323
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
@@ -346,7 +343,7 @@
|
|
346
343
|
21</pre>
|
347
344
|
</td>
|
348
345
|
<td>
|
349
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/
|
346
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/backends/hash.rb', line 19</span>
|
350
347
|
|
351
348
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
352
349
|
<span class='ivar'>@data</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>&&</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
@@ -366,7 +363,7 @@
|
|
366
363
|
<div class="method_details first">
|
367
364
|
<h3 class="signature first" id="data-instance_method">
|
368
365
|
|
369
|
-
- (<tt><span class='object_link'><a href="" title="Elephas::
|
366
|
+
- (<tt><span class='object_link'><a href="" title="Elephas::Backends::Hash (class)">Hash</a></span></tt>) <strong>data</strong>
|
370
367
|
|
371
368
|
|
372
369
|
|
@@ -374,7 +371,7 @@
|
|
374
371
|
|
375
372
|
</h3><div class="docstring">
|
376
373
|
<div class="discussion">
|
377
|
-
<p>The internal hash used by the
|
374
|
+
<p>The internal hash used by the backend.</p>
|
378
375
|
|
379
376
|
|
380
377
|
</div>
|
@@ -387,12 +384,12 @@
|
|
387
384
|
<li>
|
388
385
|
|
389
386
|
|
390
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Elephas::
|
387
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Elephas::Backends::Hash (class)">Hash</a></span></tt>)</span>
|
391
388
|
|
392
389
|
|
393
390
|
|
394
391
|
—
|
395
|
-
<div class='inline'><p>The internal hash used by the
|
392
|
+
<div class='inline'><p>The internal hash used by the backend.</p>
|
396
393
|
</div>
|
397
394
|
|
398
395
|
</li>
|
@@ -459,13 +456,13 @@
|
|
459
456
|
64</pre>
|
460
457
|
</td>
|
461
458
|
<td>
|
462
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/
|
459
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/backends/hash.rb', line 13</span>
|
463
460
|
|
464
|
-
<span class='kw'>class</span> <span class='const'>Hash</span>
|
465
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Providers</span><span class='op'>::</span><span class='const'>Base</span>
|
461
|
+
<span class='kw'>class</span> <span class='const'>Hash</span> <span class='op'><</span> <span class='const'>Base</span>
|
466
462
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:data</span>
|
467
463
|
|
468
|
-
<span class='comment'># Initialize the
|
464
|
+
<span class='comment'># Initialize the backend.
|
465
|
+
</span> <span class='comment'>#
|
469
466
|
</span> <span class='comment'># @param data [Hash] The initial data stored.
|
470
467
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
471
468
|
<span class='ivar'>@data</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>&&</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
@@ -510,7 +507,7 @@
|
|
510
507
|
</span> <span class='comment'># @return [Boolean] `true` if the key is in the cache, `false` otherwise.
|
511
508
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
512
509
|
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
513
|
-
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_valid?'>valid?</span>
|
510
|
+
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
514
511
|
<span class='kw'>end</span>
|
515
512
|
<span class='kw'>end</span></pre>
|
516
513
|
</td>
|
@@ -594,7 +591,7 @@
|
|
594
591
|
54</pre>
|
595
592
|
</td>
|
596
593
|
<td>
|
597
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/
|
594
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/backends/hash.rb', line 49</span>
|
598
595
|
|
599
596
|
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
600
597
|
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
@@ -674,11 +671,11 @@
|
|
674
671
|
63</pre>
|
675
672
|
</td>
|
676
673
|
<td>
|
677
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/
|
674
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/backends/hash.rb', line 60</span>
|
678
675
|
|
679
676
|
<span class='kw'>def</span> <span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
680
677
|
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
681
|
-
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_valid?'>valid?</span>
|
678
|
+
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
682
679
|
<span class='kw'>end</span></pre>
|
683
680
|
</td>
|
684
681
|
</tr>
|
@@ -751,7 +748,7 @@
|
|
751
748
|
29</pre>
|
752
749
|
</td>
|
753
750
|
<td>
|
754
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/
|
751
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/backends/hash.rb', line 27</span>
|
755
752
|
|
756
753
|
<span class='kw'>def</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
757
754
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
@@ -816,7 +813,7 @@
|
|
816
813
|
<span class='name'>options</span>
|
817
814
|
|
818
815
|
|
819
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Elephas::
|
816
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Elephas::Backends::Hash (class)">Hash</a></span></tt>)</span>
|
820
817
|
|
821
818
|
|
822
819
|
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
@@ -851,7 +848,7 @@
|
|
851
848
|
<p class="tag_title">See Also:</p>
|
852
849
|
<ul class="see">
|
853
850
|
|
854
|
-
<li
|
851
|
+
<li>Cache.setup_options</li>
|
855
852
|
|
856
853
|
</ul>
|
857
854
|
|
@@ -869,7 +866,7 @@
|
|
869
866
|
43</pre>
|
870
867
|
</td>
|
871
868
|
<td>
|
872
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/
|
869
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/backends/hash.rb', line 38</span>
|
873
870
|
|
874
871
|
<span class='kw'>def</span> <span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
875
872
|
<span class='id identifier rubyid_entry'>entry</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Entry</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
@@ -887,7 +884,7 @@
|
|
887
884
|
</div>
|
888
885
|
|
889
886
|
<div id="footer">
|
890
|
-
Generated on
|
887
|
+
Generated on Sun Mar 24 12:12:02 2013 by
|
891
888
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
892
889
|
0.8.5.2 (ruby-1.9.3).
|
893
890
|
</div>
|