unicache 0.0.3 → 0.0.4
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.
- checksums.yaml +7 -0
- data/CHANGELOG.rdoc +3 -0
- data/README.rdoc +4 -4
- data/doc/UniCache.html +202 -143
- data/doc/UniCache/CallbackError.html +1 -1
- data/doc/UniCache/Error.html +1 -1
- data/doc/UniCache/FetchError.html +1 -1
- data/doc/UniCache/LruEviction.html +46 -46
- data/doc/UniCache/RemoveError.html +1 -1
- data/doc/UniCache/SizeError.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.CHANGELOG.html +5 -2
- data/doc/file.README.html +7 -6
- data/doc/index.html +7 -6
- data/doc/top-level-namespace.html +1 -1
- data/lib/unicache.rb +27 -8
- data/lib/version.rb +2 -2
- metadata +30 -38
- data/Rakefile +0 -53
- data/doc/UniCache/UniCacheCommon.html +0 -132
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 000e4b3cd4cec0e1dcf6cc2481aba8f91fe7aa0f
|
4
|
+
data.tar.gz: 81ac57728d3ee82d220f88b16be855811c01d01d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6ba744c4953b73e31f180d333c71994192d5a33e50df4c44f326a1bd3d5a8fa9451fca67b48931f355d01ff094043ad43eb6730cbf772b2b3c7f93f4b0a315ce
|
7
|
+
data.tar.gz: 73eda8af1c78de44dd7fbfefcc533b7320be8fdf6113dee28af972db90b9d7762000ec9dc5c4bc0140fcbd80f1eccafccff11ef309d91c73546c251f0d20c508
|
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
== Description
|
4
4
|
|
5
|
-
UniCache is a universal purpose cache with Least Recently Used
|
5
|
+
{UniCache} is a universal purpose cache with Least Recently Used
|
6
6
|
replacement policy by default. Cache can be configured to use another
|
7
7
|
policy.
|
8
8
|
|
9
|
-
UniCache is intended to be Thread safe.
|
9
|
+
{UniCache} is intended to be Thread safe.
|
10
10
|
|
11
|
-
User can register callbacks that are run at various UniCache events.
|
11
|
+
User can register callbacks that are run at various {UniCache} events.
|
12
12
|
|
13
13
|
== Documentation
|
14
14
|
|
15
|
-
Main documentation is generated from UniCache source.
|
15
|
+
Main documentation is generated from {UniCache} source.
|
data/doc/UniCache.html
CHANGED
@@ -109,13 +109,21 @@
|
|
109
109
|
<p><span class='object_link'><a href="" title="UniCache (class)">UniCache</a></span> is Universal purpose Cache with Least Recently Used replacement
|
110
110
|
policy by default. Cache can be configured with another policy.</p>
|
111
111
|
|
112
|
-
<p><span class='object_link'><a href="" title="UniCache (class)">UniCache</a></span> is
|
112
|
+
<p><span class='object_link'><a href="" title="UniCache (class)">UniCache</a></span> is created with defined size (or without size limitations).
|
113
|
+
<span class='object_link'><a href="" title="UniCache (class)">UniCache</a></span> inherits Hash and thus almost all Hash methods are usable. The
|
114
|
+
cache content is set and referenced using Hash methods.</p>
|
113
115
|
|
114
|
-
<p>User can register callbacks that are run at various <span class='object_link'><a href="" title="UniCache (class)">UniCache</a></span> events
|
115
|
-
":getdata" callback is used to retreive cache
|
116
|
-
|
116
|
+
<p>User can register callbacks that are run at various <span class='object_link'><a href="" title="UniCache (class)">UniCache</a></span> events (see:
|
117
|
+
<span class='object_link'><a href="#registerCallback-instance_method" title="UniCache#registerCallback (method)">#registerCallback</a></span>). ":getdata" callback is used to retreive cache
|
118
|
+
data if not in cache. Other callbacks don't effect the UniCache state
|
119
|
+
(unless explicitly changed).</p>
|
117
120
|
|
118
|
-
<p>
|
121
|
+
<p>Cache can be setup with content using <span class='object_link'><a href="#open-instance_method" title="UniCache#open (method)">#open</a></span> and content can be
|
122
|
+
stored after use with <span class='object_link'><a href="#close-instance_method" title="UniCache#close (method)">#close</a></span>. The "open"/"close" actions are
|
123
|
+
defined in the corresponding callbacks.</p>
|
124
|
+
|
125
|
+
<p><span class='object_link'><a href="" title="UniCache (class)">UniCache</a></span> is intended to be Thread safe. It uses Mutex to implement access
|
126
|
+
control.</p>
|
119
127
|
|
120
128
|
<p>Usage example:</p>
|
121
129
|
|
@@ -172,7 +180,7 @@ Miss: 2:<NA></code></pre>
|
|
172
180
|
<dt id="VERSION-constant" class="">VERSION =
|
173
181
|
|
174
182
|
</dt>
|
175
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0.
|
183
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0.4</span><span class='tstring_end'>"</span></span></pre></dd>
|
176
184
|
|
177
185
|
</dl>
|
178
186
|
|
@@ -808,34 +816,42 @@ Miss: 2:<NA></code></pre>
|
|
808
816
|
<pre class="lines">
|
809
817
|
|
810
818
|
|
811
|
-
74
|
812
|
-
75
|
813
|
-
76
|
814
|
-
77
|
815
|
-
78
|
816
|
-
79
|
817
|
-
80
|
818
|
-
81
|
819
|
-
82
|
820
|
-
83
|
821
819
|
84
|
822
820
|
85
|
823
821
|
86
|
824
|
-
87
|
822
|
+
87
|
823
|
+
88
|
824
|
+
89
|
825
|
+
90
|
826
|
+
91
|
827
|
+
92
|
828
|
+
93
|
829
|
+
94
|
830
|
+
95
|
831
|
+
96
|
832
|
+
97
|
833
|
+
98
|
834
|
+
99
|
835
|
+
100
|
836
|
+
101</pre>
|
825
837
|
</td>
|
826
838
|
<td>
|
827
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
839
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 84</span>
|
828
840
|
|
829
841
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span> <span class='id identifier rubyid_size'>size</span><span class='comma'>,</span> <span class='id identifier rubyid_evict'>evict</span> <span class='op'>=</span> <span class='const'>LruEviction</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='rparen'>)</span>
|
830
842
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
831
843
|
|
832
|
-
<span class='
|
844
|
+
<span class='comment'># Access control
|
845
|
+
</span> <span class='ivar'>@lock</span> <span class='op'>=</span> <span class='const'>Mutex</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
833
846
|
|
834
|
-
<span class='
|
847
|
+
<span class='comment'># Set cache size.
|
848
|
+
</span> <span class='id identifier rubyid_resize'>resize</span><span class='lparen'>(</span> <span class='id identifier rubyid_size'>size</span> <span class='rparen'>)</span>
|
835
849
|
|
836
|
-
<span class='
|
850
|
+
<span class='comment'># Set eviction policy.
|
851
|
+
</span> <span class='id identifier rubyid_setEviction'>setEviction</span><span class='lparen'>(</span> <span class='id identifier rubyid_evict'>evict</span> <span class='rparen'>)</span>
|
837
852
|
|
838
|
-
<span class='
|
853
|
+
<span class='comment'># Declare all callbacks.
|
854
|
+
</span> <span class='ivar'>@cb</span> <span class='op'>=</span> <span class='const'>NotifyHub</span><span class='period'>.</span><span class='id identifier rubyid_declare'>declare</span><span class='lparen'>(</span> <span class='symbol'>:open</span><span class='comma'>,</span> <span class='symbol'>:close</span><span class='comma'>,</span> <span class='symbol'>:getdata</span><span class='comma'>,</span>
|
839
855
|
<span class='symbol'>:add</span><span class='comma'>,</span> <span class='symbol'>:replace</span><span class='comma'>,</span> <span class='symbol'>:put</span><span class='comma'>,</span> <span class='symbol'>:overwrite</span><span class='comma'>,</span>
|
840
856
|
<span class='symbol'>:remove</span><span class='comma'>,</span> <span class='symbol'>:valueremove</span><span class='comma'>,</span> <span class='symbol'>:hit</span><span class='comma'>,</span> <span class='symbol'>:miss</span><span class='comma'>,</span>
|
841
857
|
<span class='symbol'>:peek</span> <span class='rparen'>)</span>
|
@@ -878,12 +894,12 @@ Miss: 2:<NA></code></pre>
|
|
878
894
|
<pre class="lines">
|
879
895
|
|
880
896
|
|
881
|
-
|
882
|
-
|
883
|
-
|
897
|
+
77
|
898
|
+
78
|
899
|
+
79</pre>
|
884
900
|
</td>
|
885
901
|
<td>
|
886
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
902
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 77</span>
|
887
903
|
|
888
904
|
<span class='kw'>def</span> <span class='id identifier rubyid_lock'>lock</span>
|
889
905
|
<span class='ivar'>@lock</span>
|
@@ -921,12 +937,12 @@ Miss: 2:<NA></code></pre>
|
|
921
937
|
<pre class="lines">
|
922
938
|
|
923
939
|
|
924
|
-
|
925
|
-
|
926
|
-
|
940
|
+
74
|
941
|
+
75
|
942
|
+
76</pre>
|
927
943
|
</td>
|
928
944
|
<td>
|
929
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
945
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 74</span>
|
930
946
|
|
931
947
|
<span class='kw'>def</span> <span class='id identifier rubyid_size'>size</span>
|
932
948
|
<span class='ivar'>@size</span>
|
@@ -966,7 +982,7 @@ Miss: 2:<NA></code></pre>
|
|
966
982
|
<pre class="code"><span class="info file"># File 'lib/version.rb', line 3</span>
|
967
983
|
|
968
984
|
<span class='kw'>def</span> <span class='const'>UniCache</span><span class='period'>.</span><span class='id identifier rubyid_version'>version</span>
|
969
|
-
<span class='const'>VERSION</span>
|
985
|
+
<span class='const'>UniCache</span><span class='op'>::</span><span class='const'>VERSION</span>
|
970
986
|
<span class='kw'>end</span></pre>
|
971
987
|
</td>
|
972
988
|
</tr>
|
@@ -1005,12 +1021,12 @@ Miss: 2:<NA></code></pre>
|
|
1005
1021
|
<pre class="lines">
|
1006
1022
|
|
1007
1023
|
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1024
|
+
193
|
1025
|
+
194
|
1026
|
+
195</pre>
|
1011
1027
|
</td>
|
1012
1028
|
<td>
|
1013
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1029
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 193</span>
|
1014
1030
|
|
1015
1031
|
<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span> <span class='id identifier rubyid_key'>key</span> <span class='rparen'>)</span>
|
1016
1032
|
<span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span> <span class='id identifier rubyid_key'>key</span> <span class='rparen'>)</span>
|
@@ -1046,12 +1062,12 @@ Miss: 2:<NA></code></pre>
|
|
1046
1062
|
<pre class="lines">
|
1047
1063
|
|
1048
1064
|
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1065
|
+
167
|
1066
|
+
168
|
1067
|
+
169</pre>
|
1052
1068
|
</td>
|
1053
1069
|
<td>
|
1054
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1070
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 167</span>
|
1055
1071
|
|
1056
1072
|
<span class='kw'>def</span> <span class='op'>[]=</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='rparen'>)</span>
|
1057
1073
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_put'>put</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='rparen'>)</span>
|
@@ -1087,17 +1103,17 @@ Miss: 2:<NA></code></pre>
|
|
1087
1103
|
<pre class="lines">
|
1088
1104
|
|
1089
1105
|
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1106
|
+
335
|
1107
|
+
336
|
1108
|
+
337
|
1109
|
+
338
|
1110
|
+
339
|
1111
|
+
340
|
1112
|
+
341
|
1113
|
+
342</pre>
|
1098
1114
|
</td>
|
1099
1115
|
<td>
|
1100
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1116
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 335</span>
|
1101
1117
|
|
1102
1118
|
<span class='kw'>def</span> <span class='id identifier rubyid_clear'>clear</span>
|
1103
1119
|
<span class='ivar'>@lock</span><span class='period'>.</span><span class='id identifier rubyid_lock'>lock</span>
|
@@ -1139,12 +1155,12 @@ user would perform <span class='object_link'><a href="" title="UniCache (class)"
|
|
1139
1155
|
<pre class="lines">
|
1140
1156
|
|
1141
1157
|
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1158
|
+
141
|
1159
|
+
142
|
1160
|
+
143</pre>
|
1145
1161
|
</td>
|
1146
1162
|
<td>
|
1147
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1163
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 141</span>
|
1148
1164
|
|
1149
1165
|
<span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
|
1150
1166
|
<span class='id identifier rubyid_runCallbacks'>runCallbacks</span><span class='lparen'>(</span> <span class='symbol'>:close</span><span class='comma'>,</span> <span class='kw'>nil</span> <span class='rparen'>)</span>
|
@@ -1204,6 +1220,11 @@ user would perform <span class='object_link'><a href="" title="UniCache (class)"
|
|
1204
1220
|
|
1205
1221
|
|
1206
1222
|
|
1223
|
+
—
|
1224
|
+
<div class='inline'>
|
1225
|
+
<p>True if value found.</p>
|
1226
|
+
</div>
|
1227
|
+
|
1207
1228
|
</li>
|
1208
1229
|
|
1209
1230
|
</ul>
|
@@ -1214,16 +1235,16 @@ user would perform <span class='object_link'><a href="" title="UniCache (class)"
|
|
1214
1235
|
<pre class="lines">
|
1215
1236
|
|
1216
1237
|
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1238
|
+
213
|
1239
|
+
214
|
1240
|
+
215
|
1241
|
+
216
|
1242
|
+
217
|
1243
|
+
218
|
1244
|
+
219</pre>
|
1224
1245
|
</td>
|
1225
1246
|
<td>
|
1226
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1247
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 213</span>
|
1227
1248
|
|
1228
1249
|
<span class='kw'>def</span> <span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span> <span class='id identifier rubyid_key'>key</span> <span class='rparen'>)</span>
|
1229
1250
|
<span class='kw'>if</span> <span class='id identifier rubyid_peek'>peek</span><span class='lparen'>(</span> <span class='id identifier rubyid_key'>key</span> <span class='rparen'>)</span>
|
@@ -1299,6 +1320,24 @@ used, also when nil. <span class='object_link'><a href="" title="UniCache (class
|
|
1299
1320
|
|
1300
1321
|
</li>
|
1301
1322
|
|
1323
|
+
</ul>
|
1324
|
+
<p class="tag_title">Returns:</p>
|
1325
|
+
<ul class="return">
|
1326
|
+
|
1327
|
+
<li>
|
1328
|
+
|
1329
|
+
|
1330
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1331
|
+
|
1332
|
+
|
1333
|
+
|
1334
|
+
—
|
1335
|
+
<div class='inline'>
|
1336
|
+
<p>Cache data.</p>
|
1337
|
+
</div>
|
1338
|
+
|
1339
|
+
</li>
|
1340
|
+
|
1302
1341
|
</ul>
|
1303
1342
|
|
1304
1343
|
</div><table class="source_code">
|
@@ -1307,15 +1346,15 @@ used, also when nil. <span class='object_link'><a href="" title="UniCache (class
|
|
1307
1346
|
<pre class="lines">
|
1308
1347
|
|
1309
1348
|
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1349
|
+
184
|
1350
|
+
185
|
1351
|
+
186
|
1352
|
+
187
|
1353
|
+
188
|
1354
|
+
189</pre>
|
1316
1355
|
</td>
|
1317
1356
|
<td>
|
1318
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1357
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 184</span>
|
1319
1358
|
|
1320
1359
|
<span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span> <span class='rparen'>)</span>
|
1321
1360
|
<span class='ivar'>@lock</span><span class='period'>.</span><span class='id identifier rubyid_lock'>lock</span>
|
@@ -1343,10 +1382,10 @@ used, also when nil. <span class='object_link'><a href="" title="UniCache (class
|
|
1343
1382
|
<pre class="lines">
|
1344
1383
|
|
1345
1384
|
|
1346
|
-
|
1385
|
+
114</pre>
|
1347
1386
|
</td>
|
1348
1387
|
<td>
|
1349
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1388
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 114</span>
|
1350
1389
|
|
1351
1390
|
<span class='kw'>alias</span> <span class='symbol'>:hash_get_op</span> <span class='symbol'>:[]</span></pre>
|
1352
1391
|
</td>
|
@@ -1369,10 +1408,10 @@ used, also when nil. <span class='object_link'><a href="" title="UniCache (class
|
|
1369
1408
|
<pre class="lines">
|
1370
1409
|
|
1371
1410
|
|
1372
|
-
|
1411
|
+
113</pre>
|
1373
1412
|
</td>
|
1374
1413
|
<td>
|
1375
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1414
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 113</span>
|
1376
1415
|
|
1377
1416
|
<span class='kw'>alias</span> <span class='symbol'>:hash_set_op</span> <span class='symbol'>:[]=</span></pre>
|
1378
1417
|
</td>
|
@@ -1395,10 +1434,10 @@ used, also when nil. <span class='object_link'><a href="" title="UniCache (class
|
|
1395
1434
|
<pre class="lines">
|
1396
1435
|
|
1397
1436
|
|
1398
|
-
|
1437
|
+
116</pre>
|
1399
1438
|
</td>
|
1400
1439
|
<td>
|
1401
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1440
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 116</span>
|
1402
1441
|
|
1403
1442
|
<span class='kw'>alias</span> <span class='symbol'>:hash_store</span> <span class='symbol'>:store</span></pre>
|
1404
1443
|
</td>
|
@@ -1433,12 +1472,12 @@ user would perform <span class='object_link'><a href="" title="UniCache (class)"
|
|
1433
1472
|
<pre class="lines">
|
1434
1473
|
|
1435
1474
|
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1475
|
+
133
|
1476
|
+
134
|
1477
|
+
135</pre>
|
1439
1478
|
</td>
|
1440
1479
|
<td>
|
1441
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1480
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 133</span>
|
1442
1481
|
|
1443
1482
|
<span class='kw'>def</span> <span class='id identifier rubyid_open'>open</span>
|
1444
1483
|
<span class='id identifier rubyid_runCallbacks'>runCallbacks</span><span class='lparen'>(</span> <span class='symbol'>:open</span><span class='comma'>,</span> <span class='kw'>nil</span> <span class='rparen'>)</span>
|
@@ -1487,6 +1526,24 @@ user would perform <span class='object_link'><a href="" title="UniCache (class)"
|
|
1487
1526
|
|
1488
1527
|
</ul>
|
1489
1528
|
|
1529
|
+
<p class="tag_title">Returns:</p>
|
1530
|
+
<ul class="return">
|
1531
|
+
|
1532
|
+
<li>
|
1533
|
+
|
1534
|
+
|
1535
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1536
|
+
|
1537
|
+
|
1538
|
+
|
1539
|
+
—
|
1540
|
+
<div class='inline'>
|
1541
|
+
<p>Cache data.</p>
|
1542
|
+
</div>
|
1543
|
+
|
1544
|
+
</li>
|
1545
|
+
|
1546
|
+
</ul>
|
1490
1547
|
|
1491
1548
|
</div><table class="source_code">
|
1492
1549
|
<tr>
|
@@ -1494,13 +1551,13 @@ user would perform <span class='object_link'><a href="" title="UniCache (class)"
|
|
1494
1551
|
<pre class="lines">
|
1495
1552
|
|
1496
1553
|
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1554
|
+
202
|
1555
|
+
203
|
1556
|
+
204
|
1557
|
+
205</pre>
|
1501
1558
|
</td>
|
1502
1559
|
<td>
|
1503
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1560
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 202</span>
|
1504
1561
|
|
1505
1562
|
<span class='kw'>def</span> <span class='id identifier rubyid_peek'>peek</span><span class='lparen'>(</span> <span class='id identifier rubyid_key'>key</span> <span class='rparen'>)</span>
|
1506
1563
|
<span class='id identifier rubyid_runCallbacks'>runCallbacks</span><span class='lparen'>(</span> <span class='symbol'>:peek</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span> <span class='rparen'>)</span>
|
@@ -1573,15 +1630,15 @@ user would perform <span class='object_link'><a href="" title="UniCache (class)"
|
|
1573
1630
|
<pre class="lines">
|
1574
1631
|
|
1575
1632
|
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1633
|
+
158
|
1634
|
+
159
|
1635
|
+
160
|
1636
|
+
161
|
1637
|
+
162
|
1638
|
+
163</pre>
|
1582
1639
|
</td>
|
1583
1640
|
<td>
|
1584
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1641
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 158</span>
|
1585
1642
|
|
1586
1643
|
<span class='kw'>def</span> <span class='id identifier rubyid_put'>put</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='rparen'>)</span>
|
1587
1644
|
<span class='ivar'>@lock</span><span class='period'>.</span><span class='id identifier rubyid_lock'>lock</span>
|
@@ -1651,7 +1708,8 @@ entry.</p>
|
|
1651
1708
|
<p>Entry is found in Cache. <key,value> from cache.</p>
|
1652
1709
|
</dd><dt>:miss</dt>
|
1653
1710
|
<dd>
|
1654
|
-
<p>Entry is not found in Cache. <key> from request
|
1711
|
+
<p>Entry is not found in Cache. <key> from request. Callback is called
|
1712
|
+
before ":getdata".</p>
|
1655
1713
|
</dd><dt>:peek</dt>
|
1656
1714
|
<dd>
|
1657
1715
|
<p>Cache peek. <key,value> from request.</p>
|
@@ -1711,16 +1769,16 @@ entry.</p>
|
|
1711
1769
|
<pre class="lines">
|
1712
1770
|
|
1713
1771
|
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1772
|
+
311
|
1773
|
+
312
|
1774
|
+
313
|
1775
|
+
314
|
1776
|
+
315
|
1777
|
+
316
|
1778
|
+
317</pre>
|
1721
1779
|
</td>
|
1722
1780
|
<td>
|
1723
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1781
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 311</span>
|
1724
1782
|
|
1725
1783
|
<span class='kw'>def</span> <span class='id identifier rubyid_registerCallback'>registerCallback</span><span class='lparen'>(</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_proc'>proc</span> <span class='rparen'>)</span>
|
1726
1784
|
<span class='kw'>begin</span>
|
@@ -1800,15 +1858,15 @@ entry.</p>
|
|
1800
1858
|
<pre class="lines">
|
1801
1859
|
|
1802
1860
|
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1861
|
+
226
|
1862
|
+
227
|
1863
|
+
228
|
1864
|
+
229
|
1865
|
+
230
|
1866
|
+
231</pre>
|
1809
1867
|
</td>
|
1810
1868
|
<td>
|
1811
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1869
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 226</span>
|
1812
1870
|
|
1813
1871
|
<span class='kw'>def</span> <span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span> <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='rparen'>)</span>
|
1814
1872
|
<span class='ivar'>@lock</span><span class='period'>.</span><span class='id identifier rubyid_lock'>lock</span>
|
@@ -1869,18 +1927,18 @@ entry.</p>
|
|
1869
1927
|
<pre class="lines">
|
1870
1928
|
|
1871
1929
|
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1930
|
+
323
|
1931
|
+
324
|
1932
|
+
325
|
1933
|
+
326
|
1934
|
+
327
|
1935
|
+
328
|
1936
|
+
329
|
1937
|
+
330
|
1938
|
+
331</pre>
|
1881
1939
|
</td>
|
1882
1940
|
<td>
|
1883
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
1941
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 323</span>
|
1884
1942
|
|
1885
1943
|
<span class='kw'>def</span> <span class='id identifier rubyid_removeCallback'>removeCallback</span><span class='lparen'>(</span> <span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='rparen'>)</span>
|
1886
1944
|
<span class='kw'>if</span> <span class='id identifier rubyid_type'>type</span>
|
@@ -1973,30 +2031,30 @@ entry.</p>
|
|
1973
2031
|
<pre class="lines">
|
1974
2032
|
|
1975
2033
|
|
1976
|
-
220
|
1977
|
-
221
|
1978
|
-
222
|
1979
|
-
223
|
1980
|
-
224
|
1981
|
-
225
|
1982
|
-
226
|
1983
|
-
227
|
1984
|
-
228
|
1985
|
-
229
|
1986
|
-
230
|
1987
|
-
231
|
1988
|
-
232
|
1989
|
-
233
|
1990
|
-
234
|
1991
|
-
235
|
1992
|
-
236
|
1993
|
-
237
|
1994
2034
|
238
|
1995
2035
|
239
|
1996
|
-
240
|
2036
|
+
240
|
2037
|
+
241
|
2038
|
+
242
|
2039
|
+
243
|
2040
|
+
244
|
2041
|
+
245
|
2042
|
+
246
|
2043
|
+
247
|
2044
|
+
248
|
2045
|
+
249
|
2046
|
+
250
|
2047
|
+
251
|
2048
|
+
252
|
2049
|
+
253
|
2050
|
+
254
|
2051
|
+
255
|
2052
|
+
256
|
2053
|
+
257
|
2054
|
+
258</pre>
|
1997
2055
|
</td>
|
1998
2056
|
<td>
|
1999
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
2057
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 238</span>
|
2000
2058
|
|
2001
2059
|
<span class='kw'>def</span> <span class='id identifier rubyid_resize'>resize</span><span class='lparen'>(</span> <span class='id identifier rubyid_size'>size</span> <span class='rparen'>)</span>
|
2002
2060
|
|
@@ -2036,7 +2094,8 @@ entry.</p>
|
|
2036
2094
|
</h3><div class="docstring">
|
2037
2095
|
<div class="discussion">
|
2038
2096
|
|
2039
|
-
<p>Set the eviction policy
|
2097
|
+
<p>Set the eviction policy. Evictor should have the same interface as
|
2098
|
+
<span class='object_link'><a href="UniCache/LruEviction.html" title="UniCache::LruEviction (class)">LruEviction</a></span>.</p>
|
2040
2099
|
|
2041
2100
|
|
2042
2101
|
</div>
|
@@ -2070,12 +2129,12 @@ entry.</p>
|
|
2070
2129
|
<pre class="lines">
|
2071
2130
|
|
2072
2131
|
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2132
|
+
108
|
2133
|
+
109
|
2134
|
+
110</pre>
|
2076
2135
|
</td>
|
2077
2136
|
<td>
|
2078
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
2137
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 108</span>
|
2079
2138
|
|
2080
2139
|
<span class='kw'>def</span> <span class='id identifier rubyid_setEviction'>setEviction</span><span class='lparen'>(</span> <span class='id identifier rubyid_evict'>evict</span> <span class='rparen'>)</span>
|
2081
2140
|
<span class='ivar'>@evict</span> <span class='op'>=</span> <span class='id identifier rubyid_evict'>evict</span>
|
@@ -2111,10 +2170,10 @@ entry.</p>
|
|
2111
2170
|
<pre class="lines">
|
2112
2171
|
|
2113
2172
|
|
2114
|
-
|
2173
|
+
147</pre>
|
2115
2174
|
</td>
|
2116
2175
|
<td>
|
2117
|
-
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line
|
2176
|
+
<pre class="code"><span class="info file"># File 'lib/unicache.rb', line 147</span>
|
2118
2177
|
|
2119
2178
|
<span class='kw'>def</span> <span class='id identifier rubyid_store'>store</span><span class='lparen'>(</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
|
2120
2179
|
</td>
|
@@ -2127,7 +2186,7 @@ entry.</p>
|
|
2127
2186
|
</div>
|
2128
2187
|
|
2129
2188
|
<div id="footer">
|
2130
|
-
Generated on
|
2189
|
+
Generated on Sun Nov 23 14:33:03 2014 by
|
2131
2190
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2132
2191
|
0.8.6.1 (ruby-1.9.3).
|
2133
2192
|
</div>
|