localmemcache 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +18 -11
- data/Rakefile +22 -7
- data/VERSION +1 -1
- data/bench/common.rb +7 -0
- data/bench/gdbm_vs_lmc +10 -0
- data/bench/gdbm_vs_lmc.rb +29 -0
- data/bench/lmc_bench +11 -0
- data/bench/lmc_bench.rb +27 -0
- data/bench/memcached_bench +8 -0
- data/bench/memcached_bench.rb +19 -0
- data/bench/tyrant_bench +10 -0
- data/bench/tyrant_bench.rb +19 -0
- data/example/hello.c +1 -1
- data/site/doc/classes/LocalMemCache/ArgError.html +113 -0
- data/site/doc/classes/LocalMemCache/InitError.html +113 -0
- data/site/doc/classes/LocalMemCache/LocalMemCacheError.html +111 -0
- data/site/doc/classes/LocalMemCache/LockError.html +113 -0
- data/site/doc/classes/LocalMemCache/LockTimedOut.html +113 -0
- data/site/doc/classes/LocalMemCache/MemoryPoolClosed.html +113 -0
- data/site/doc/classes/LocalMemCache/MemoryPoolFull.html +113 -0
- data/site/doc/classes/LocalMemCache/OutOfMemoryError.html +113 -0
- data/site/doc/classes/LocalMemCache/RecoveryFailed.html +113 -0
- data/site/doc/classes/LocalMemCache/ShmError.html +113 -0
- data/site/doc/classes/LocalMemCache/ShmLockFailed.html +113 -0
- data/site/doc/classes/LocalMemCache/ShmUnlockFailed.html +113 -0
- data/site/doc/classes/LocalMemCache.html +515 -0
- data/site/doc/classes/LocalMemCache.src/M000001.html +19 -0
- data/site/doc/classes/LocalMemCache.src/M000002.html +18 -0
- data/site/doc/classes/LocalMemCache.src/M000003.html +18 -0
- data/site/doc/classes/LocalMemCache.src/M000004.html +39 -0
- data/site/doc/classes/LocalMemCache.src/M000005.html +29 -0
- data/site/doc/classes/LocalMemCache.src/M000006.html +23 -0
- data/site/doc/classes/LocalMemCache.src/M000007.html +23 -0
- data/site/doc/classes/LocalMemCache.src/M000008.html +22 -0
- data/site/doc/classes/LocalMemCache.src/M000009.html +24 -0
- data/site/doc/classes/LocalMemCache.src/M000010.html +24 -0
- data/site/doc/classes/LocalMemCache.src/M000011.html +22 -0
- data/site/doc/classes/LocalMemCache.src/M000012.html +22 -0
- data/site/doc/created.rid +1 -0
- data/site/doc/files/__/src/ruby-binding/extconf_rb.html +108 -0
- data/site/doc/files/__/src/ruby-binding/localmemcache_rb.html +108 -0
- data/site/doc/files/__/src/ruby-binding/rblocalmemcache_c.html +101 -0
- data/site/doc/fr_class_index.html +39 -0
- data/site/doc/fr_file_index.html +28 -0
- data/site/doc/fr_method_index.html +38 -0
- data/site/doc/index.html +24 -0
- data/site/doc/rdoc-style.css +208 -0
- data/site/index.html +50 -46
- data/src/lmc_common.c +22 -0
- data/src/lmc_common.h +4 -0
- data/src/lmc_hashtable.h +1 -1
- data/src/lmc_lock.c +17 -3
- data/src/lmc_shm.c +4 -2
- data/src/lmc_valloc.c +6 -5
- data/src/lmc_valloc.h +1 -0
- data/src/localmemcache.c +56 -35
- data/src/localmemcache.h +161 -4
- data/src/ruby-binding/localmemcache.rb +48 -16
- data/src/ruby-binding/rblocalmemcache.c +131 -24
- data/src/tests/bench.rb +1 -1
- data/src/tests/lmc.rb +11 -2
- metadata +48 -7
- data/INTERNALS +0 -26
- data/example/hello.bin +0 -0
@@ -0,0 +1,515 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: LocalMemCache</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">LocalMemCache</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/__/src/ruby-binding/localmemcache_rb.html">
|
59
|
+
../src/ruby-binding/localmemcache.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../files/__/src/ruby-binding/rblocalmemcache_c.html">
|
63
|
+
../src/ruby-binding/rblocalmemcache.c
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
</td>
|
67
|
+
</tr>
|
68
|
+
|
69
|
+
<tr class="top-aligned-row">
|
70
|
+
<td><strong>Parent:</strong></td>
|
71
|
+
<td>
|
72
|
+
Object
|
73
|
+
</td>
|
74
|
+
</tr>
|
75
|
+
</table>
|
76
|
+
</div>
|
77
|
+
<!-- banner header -->
|
78
|
+
|
79
|
+
<div id="bodyContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
<div id="contextContent">
|
84
|
+
|
85
|
+
<div id="description">
|
86
|
+
<p>
|
87
|
+
<tt><a href="LocalMemCache.html">LocalMemCache</a></tt> provides for a
|
88
|
+
Hashtable of strings in shared memory (via a memory mapped file), which
|
89
|
+
thus can be shared between processes on a computer. Here is an example of
|
90
|
+
its usage:
|
91
|
+
</p>
|
92
|
+
<pre>
|
93
|
+
$lm = LocalMemCache.new :namespace => "viewcounters"
|
94
|
+
$lm[:foo] = 1
|
95
|
+
$lm[:foo] # -> "1"
|
96
|
+
$lm.delete(:foo)
|
97
|
+
</pre>
|
98
|
+
<p>
|
99
|
+
<tt><a href="LocalMemCache.html">LocalMemCache</a></tt> can also be used as
|
100
|
+
a persistent key value database, just use the :filename instead of the
|
101
|
+
:namespace parameter.
|
102
|
+
</p>
|
103
|
+
<pre>
|
104
|
+
$lm = LocalMemCache.new :filename => "my-database.lmc"
|
105
|
+
$lm[:foo] = 1
|
106
|
+
$lm[:foo] # -> "1"
|
107
|
+
$lm.delete(:foo)
|
108
|
+
|
109
|
+
== Default sizes of memory pools
|
110
|
+
|
111
|
+
The default size for memory pools is 1024 (MB). It cannot be changed later,
|
112
|
+
so choose a size that will provide enough space for all your data. You
|
113
|
+
might consider setting this size to the maximum filesize of your
|
114
|
+
filesystem. Also note that while these memory pools may look large on your
|
115
|
+
disk, they really aren't, because with sparse files only those parts of the
|
116
|
+
file which contain non-null data actually use disk space.
|
117
|
+
|
118
|
+
== Automatic recovery from crashes
|
119
|
+
|
120
|
+
In case a process is terminated while accessing a memory pool, other
|
121
|
+
processes will wait for the lock up to 2 seconds, and will then try to
|
122
|
+
resume the aborted operation. This can also be done explicitly by using
|
123
|
+
LocalMemCache.check(options).
|
124
|
+
|
125
|
+
== Clearing memory pools
|
126
|
+
|
127
|
+
Removing memory pools can be done with LocalMemCache.clear(options).
|
128
|
+
|
129
|
+
== Environment
|
130
|
+
|
131
|
+
If you use the :namespace parameter, the .lmc file for your namespace will
|
132
|
+
reside in /var/tmp/localmemcache. This can be overriden by setting the
|
133
|
+
LMC_NAMESPACES_ROOT_PATH variable in the environment.
|
134
|
+
</pre>
|
135
|
+
|
136
|
+
</div>
|
137
|
+
|
138
|
+
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div id="method-list">
|
142
|
+
<h3 class="section-bar">Methods</h3>
|
143
|
+
|
144
|
+
<div class="name-list">
|
145
|
+
<a href="#M000007">[]</a>
|
146
|
+
<a href="#M000010">[]=</a>
|
147
|
+
<a href="#M000005">check</a>
|
148
|
+
<a href="#M000003">check_namespace</a>
|
149
|
+
<a href="#M000004">clear</a>
|
150
|
+
<a href="#M000002">clear_namespace</a>
|
151
|
+
<a href="#M000012">close</a>
|
152
|
+
<a href="#M000008">delete</a>
|
153
|
+
<a href="#M000006">get</a>
|
154
|
+
<a href="#M000011">keys</a>
|
155
|
+
<a href="#M000001">new</a>
|
156
|
+
<a href="#M000009">set</a>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
</div>
|
161
|
+
|
162
|
+
|
163
|
+
<!-- if includes -->
|
164
|
+
|
165
|
+
<div id="section">
|
166
|
+
|
167
|
+
<div id="class-list">
|
168
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
169
|
+
|
170
|
+
Class <a href="LocalMemCache/ArgError.html" class="link">LocalMemCache::ArgError</a><br />
|
171
|
+
Class <a href="LocalMemCache/InitError.html" class="link">LocalMemCache::InitError</a><br />
|
172
|
+
Class <a href="LocalMemCache/LocalMemCacheError.html" class="link">LocalMemCache::LocalMemCacheError</a><br />
|
173
|
+
Class <a href="LocalMemCache/LockError.html" class="link">LocalMemCache::LockError</a><br />
|
174
|
+
Class <a href="LocalMemCache/LockTimedOut.html" class="link">LocalMemCache::LockTimedOut</a><br />
|
175
|
+
Class <a href="LocalMemCache/MemoryPoolClosed.html" class="link">LocalMemCache::MemoryPoolClosed</a><br />
|
176
|
+
Class <a href="LocalMemCache/MemoryPoolFull.html" class="link">LocalMemCache::MemoryPoolFull</a><br />
|
177
|
+
Class <a href="LocalMemCache/OutOfMemoryError.html" class="link">LocalMemCache::OutOfMemoryError</a><br />
|
178
|
+
Class <a href="LocalMemCache/RecoveryFailed.html" class="link">LocalMemCache::RecoveryFailed</a><br />
|
179
|
+
Class <a href="LocalMemCache/ShmError.html" class="link">LocalMemCache::ShmError</a><br />
|
180
|
+
Class <a href="LocalMemCache/ShmLockFailed.html" class="link">LocalMemCache::ShmLockFailed</a><br />
|
181
|
+
Class <a href="LocalMemCache/ShmUnlockFailed.html" class="link">LocalMemCache::ShmUnlockFailed</a><br />
|
182
|
+
|
183
|
+
</div>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<!-- if method_list -->
|
192
|
+
<div id="methods">
|
193
|
+
<h3 class="section-bar">Public Class methods</h3>
|
194
|
+
|
195
|
+
<div id="method-M000005" class="method-detail">
|
196
|
+
<a name="M000005"></a>
|
197
|
+
|
198
|
+
<div class="method-heading">
|
199
|
+
<a href="LocalMemCache.src/M000005.html" target="Code" class="method-signature"
|
200
|
+
onclick="popupCode('LocalMemCache.src/M000005.html');return false;">
|
201
|
+
<span class="method-name"> LocalMemCache.check(*args)<br />
|
202
|
+
</span>
|
203
|
+
</a>
|
204
|
+
</div>
|
205
|
+
|
206
|
+
<div class="method-description">
|
207
|
+
<p>
|
208
|
+
Tries to repair a corrupt namespace. Usually one doesn‘t call this
|
209
|
+
method directly, it‘s invoked automatically when operations time out.
|
210
|
+
</p>
|
211
|
+
<p>
|
212
|
+
valid options are [:namespace] [:filename]
|
213
|
+
</p>
|
214
|
+
<p>
|
215
|
+
The memory pool must be specified by either setting the :filename or
|
216
|
+
:namespace option.
|
217
|
+
</p>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div id="method-M000003" class="method-detail">
|
222
|
+
<a name="M000003"></a>
|
223
|
+
|
224
|
+
<div class="method-heading">
|
225
|
+
<a href="LocalMemCache.src/M000003.html" target="Code" class="method-signature"
|
226
|
+
onclick="popupCode('LocalMemCache.src/M000003.html');return false;">
|
227
|
+
<span class="method-name">check_namespace</span><span class="method-args">(namespace)</span>
|
228
|
+
</a>
|
229
|
+
</div>
|
230
|
+
|
231
|
+
<div class="method-description">
|
232
|
+
<p>
|
233
|
+
NOTE: This method is deprecated, use <a
|
234
|
+
href="LocalMemCache.html#M000005">LocalMemCache.check(*args)</a> instead.
|
235
|
+
</p>
|
236
|
+
<p>
|
237
|
+
Tries to repair a corrupt namespace. Usually one doesn‘t call this
|
238
|
+
method directly, it‘s invoked automatically when operations time out.
|
239
|
+
</p>
|
240
|
+
<p>
|
241
|
+
valid options are [:namespace] [:filename]
|
242
|
+
</p>
|
243
|
+
<p>
|
244
|
+
The memory pool must be specified by either setting the :filename or
|
245
|
+
:namespace option. The default for :repair is false.
|
246
|
+
</p>
|
247
|
+
</div>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div id="method-M000004" class="method-detail">
|
251
|
+
<a name="M000004"></a>
|
252
|
+
|
253
|
+
<div class="method-heading">
|
254
|
+
<a href="LocalMemCache.src/M000004.html" target="Code" class="method-signature"
|
255
|
+
onclick="popupCode('LocalMemCache.src/M000004.html');return false;">
|
256
|
+
<span class="method-name"> LocalMemCache.clear(*args)<br />
|
257
|
+
</span>
|
258
|
+
</a>
|
259
|
+
</div>
|
260
|
+
|
261
|
+
<div class="method-description">
|
262
|
+
<p>
|
263
|
+
Deletes a memory pool. If the :repair option is <a
|
264
|
+
href="LocalMemCache.html#M000009">set</a>, locked semaphores are removed as
|
265
|
+
well.
|
266
|
+
</p>
|
267
|
+
<p>
|
268
|
+
WARNING: Do only call this method with the :repair option if you are sure
|
269
|
+
that you really want to remove this memory pool and no more processes are
|
270
|
+
still using it.
|
271
|
+
</p>
|
272
|
+
<p>
|
273
|
+
If you <a href="LocalMemCache.html#M000008">delete</a> a pool and other
|
274
|
+
processes still have handles open on it, the status of these handles
|
275
|
+
becomes undefined. There‘s no way for a process to know when a handle
|
276
|
+
is not valid anymore, so only <a
|
277
|
+
href="LocalMemCache.html#M000008">delete</a> a memory pool if you are sure
|
278
|
+
that all handles are closed.
|
279
|
+
</p>
|
280
|
+
<p>
|
281
|
+
valid options for <a href="LocalMemCache.html#M000004">clear</a> are
|
282
|
+
[:namespace] [:filename] [:repair]
|
283
|
+
</p>
|
284
|
+
<p>
|
285
|
+
The memory pool must be specified by either setting the :filename or
|
286
|
+
:namespace option. The default for :repair is false.
|
287
|
+
</p>
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
|
291
|
+
<div id="method-M000002" class="method-detail">
|
292
|
+
<a name="M000002"></a>
|
293
|
+
|
294
|
+
<div class="method-heading">
|
295
|
+
<a href="LocalMemCache.src/M000002.html" target="Code" class="method-signature"
|
296
|
+
onclick="popupCode('LocalMemCache.src/M000002.html');return false;">
|
297
|
+
<span class="method-name">clear_namespace</span><span class="method-args">(namespace, repair = false)</span>
|
298
|
+
</a>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
<div class="method-description">
|
302
|
+
<p>
|
303
|
+
NOTE: This method is deprecated, use <a
|
304
|
+
href="LocalMemCache.html#M000004">LocalMemCache.clear(*args)</a> instead.
|
305
|
+
</p>
|
306
|
+
<p>
|
307
|
+
Deletes a memory pool. If the repair flag is <a
|
308
|
+
href="LocalMemCache.html#M000009">set</a>, locked semaphores are removed as
|
309
|
+
well.
|
310
|
+
</p>
|
311
|
+
<p>
|
312
|
+
If you <a href="LocalMemCache.html#M000008">delete</a> a pool and other
|
313
|
+
processes still have handles open on it, the status of these handles
|
314
|
+
becomes undefined. There‘s no way for a process to know when a handle
|
315
|
+
is not valid anymore, so only <a
|
316
|
+
href="LocalMemCache.html#M000008">delete</a> a memory pool if you are sure
|
317
|
+
that all handles are closed.
|
318
|
+
</p>
|
319
|
+
<p>
|
320
|
+
WARNING: Do only call this method with the repair=true flag if you are sure
|
321
|
+
that you really want to remove this memory pool and no more processes are
|
322
|
+
still using it.
|
323
|
+
</p>
|
324
|
+
</div>
|
325
|
+
</div>
|
326
|
+
|
327
|
+
<div id="method-M000001" class="method-detail">
|
328
|
+
<a name="M000001"></a>
|
329
|
+
|
330
|
+
<div class="method-heading">
|
331
|
+
<a href="LocalMemCache.src/M000001.html" target="Code" class="method-signature"
|
332
|
+
onclick="popupCode('LocalMemCache.src/M000001.html');return false;">
|
333
|
+
<span class="method-name">new</span><span class="method-args">(options)</span>
|
334
|
+
</a>
|
335
|
+
</div>
|
336
|
+
|
337
|
+
<div class="method-description">
|
338
|
+
<p>
|
339
|
+
Creates a <a href="LocalMemCache.html#M000001">new</a> handle for accessing
|
340
|
+
a shared memory region.
|
341
|
+
</p>
|
342
|
+
<p>
|
343
|
+
<a href="LocalMemCache.html#M000001">LocalMemCache.new</a>
|
344
|
+
:namespace=>"foo", :size_mb=> 1
|
345
|
+
</p>
|
346
|
+
<p>
|
347
|
+
<a href="LocalMemCache.html#M000001">LocalMemCache.new</a>
|
348
|
+
:filename=>"./foo.lmc"
|
349
|
+
</p>
|
350
|
+
<p>
|
351
|
+
You must supply at least a :namespace or :filename parameter The size_mb
|
352
|
+
defaults to 1024 (1 GB).
|
353
|
+
</p>
|
354
|
+
<p>
|
355
|
+
If you use the :namespace parameter, the .lmc file for your namespace will
|
356
|
+
reside in /var/tmp/localmemcache. This can be overriden by setting the
|
357
|
+
LMC_NAMESPACES_ROOT_PATH variable in the environment.
|
358
|
+
</p>
|
359
|
+
<p>
|
360
|
+
When you first call .<a href="LocalMemCache.html#M000001">new</a> for a
|
361
|
+
previously not existing memory pool, a sparse file will be created and
|
362
|
+
memory and disk space will be allocated to hold the empty hashtable (about
|
363
|
+
100K), so the size_mb refers only to the maximum size of the memory pool.
|
364
|
+
.<a href="LocalMemCache.html#M000001">new</a> for an already existing
|
365
|
+
memory pool will only map the already previously allocated RAM into the
|
366
|
+
virtual address space of your process.
|
367
|
+
</p>
|
368
|
+
</div>
|
369
|
+
</div>
|
370
|
+
|
371
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
372
|
+
|
373
|
+
<div id="method-M000007" class="method-detail">
|
374
|
+
<a name="M000007"></a>
|
375
|
+
|
376
|
+
<div class="method-heading">
|
377
|
+
<a href="LocalMemCache.src/M000007.html" target="Code" class="method-signature"
|
378
|
+
onclick="popupCode('LocalMemCache.src/M000007.html');return false;">
|
379
|
+
<span class="method-name">lmc.get(key) → string value or nil<br />
|
380
|
+
lmc[key] → string value or nil<br />
|
381
|
+
</span>
|
382
|
+
</a>
|
383
|
+
</div>
|
384
|
+
|
385
|
+
<div class="method-description">
|
386
|
+
<p>
|
387
|
+
Retrieve string value from hashtable.
|
388
|
+
</p>
|
389
|
+
</div>
|
390
|
+
</div>
|
391
|
+
|
392
|
+
<div id="method-M000010" class="method-detail">
|
393
|
+
<a name="M000010"></a>
|
394
|
+
|
395
|
+
<div class="method-heading">
|
396
|
+
<a href="LocalMemCache.src/M000010.html" target="Code" class="method-signature"
|
397
|
+
onclick="popupCode('LocalMemCache.src/M000010.html');return false;">
|
398
|
+
<span class="method-name">lmc.set(key, value) → Qnil<br />
|
399
|
+
lmc[key]=value → Qnil<br />
|
400
|
+
</span>
|
401
|
+
</a>
|
402
|
+
</div>
|
403
|
+
|
404
|
+
<div class="method-description">
|
405
|
+
<p>
|
406
|
+
Set value for key in hashtable. Value and key will be converted to string.
|
407
|
+
</p>
|
408
|
+
</div>
|
409
|
+
</div>
|
410
|
+
|
411
|
+
<div id="method-M000012" class="method-detail">
|
412
|
+
<a name="M000012"></a>
|
413
|
+
|
414
|
+
<div class="method-heading">
|
415
|
+
<a href="LocalMemCache.src/M000012.html" target="Code" class="method-signature"
|
416
|
+
onclick="popupCode('LocalMemCache.src/M000012.html');return false;">
|
417
|
+
<span class="method-name">lmc.close() → Qnil<br />
|
418
|
+
</span>
|
419
|
+
</a>
|
420
|
+
</div>
|
421
|
+
|
422
|
+
<div class="method-description">
|
423
|
+
<p>
|
424
|
+
Releases hashtable.
|
425
|
+
</p>
|
426
|
+
</div>
|
427
|
+
</div>
|
428
|
+
|
429
|
+
<div id="method-M000008" class="method-detail">
|
430
|
+
<a name="M000008"></a>
|
431
|
+
|
432
|
+
<div class="method-heading">
|
433
|
+
<a href="LocalMemCache.src/M000008.html" target="Code" class="method-signature"
|
434
|
+
onclick="popupCode('LocalMemCache.src/M000008.html');return false;">
|
435
|
+
<span class="method-name">lmc.delete(key) → Qnil<br />
|
436
|
+
</span>
|
437
|
+
</a>
|
438
|
+
</div>
|
439
|
+
|
440
|
+
<div class="method-description">
|
441
|
+
<p>
|
442
|
+
Deletes key from hashtable. The key is converted to string.
|
443
|
+
</p>
|
444
|
+
</div>
|
445
|
+
</div>
|
446
|
+
|
447
|
+
<div id="method-M000006" class="method-detail">
|
448
|
+
<a name="M000006"></a>
|
449
|
+
|
450
|
+
<div class="method-heading">
|
451
|
+
<a href="LocalMemCache.src/M000006.html" target="Code" class="method-signature"
|
452
|
+
onclick="popupCode('LocalMemCache.src/M000006.html');return false;">
|
453
|
+
<span class="method-name">lmc.get(key) → string value or nil<br />
|
454
|
+
lmc[key] → string value or nil<br />
|
455
|
+
</span>
|
456
|
+
</a>
|
457
|
+
</div>
|
458
|
+
|
459
|
+
<div class="method-description">
|
460
|
+
<p>
|
461
|
+
Retrieve string value from hashtable.
|
462
|
+
</p>
|
463
|
+
</div>
|
464
|
+
</div>
|
465
|
+
|
466
|
+
<div id="method-M000011" class="method-detail">
|
467
|
+
<a name="M000011"></a>
|
468
|
+
|
469
|
+
<div class="method-heading">
|
470
|
+
<a href="LocalMemCache.src/M000011.html" target="Code" class="method-signature"
|
471
|
+
onclick="popupCode('LocalMemCache.src/M000011.html');return false;">
|
472
|
+
<span class="method-name">lmc.keys() → array or nil<br />
|
473
|
+
</span>
|
474
|
+
</a>
|
475
|
+
</div>
|
476
|
+
|
477
|
+
<div class="method-description">
|
478
|
+
<p>
|
479
|
+
Returns a list of <a href="LocalMemCache.html#M000011">keys</a>.
|
480
|
+
</p>
|
481
|
+
</div>
|
482
|
+
</div>
|
483
|
+
|
484
|
+
<div id="method-M000009" class="method-detail">
|
485
|
+
<a name="M000009"></a>
|
486
|
+
|
487
|
+
<div class="method-heading">
|
488
|
+
<a href="LocalMemCache.src/M000009.html" target="Code" class="method-signature"
|
489
|
+
onclick="popupCode('LocalMemCache.src/M000009.html');return false;">
|
490
|
+
<span class="method-name">lmc.set(key, value) → Qnil<br />
|
491
|
+
lmc[key]=value → Qnil<br />
|
492
|
+
</span>
|
493
|
+
</a>
|
494
|
+
</div>
|
495
|
+
|
496
|
+
<div class="method-description">
|
497
|
+
<p>
|
498
|
+
Set value for key in hashtable. Value and key will be converted to string.
|
499
|
+
</p>
|
500
|
+
</div>
|
501
|
+
</div>
|
502
|
+
|
503
|
+
|
504
|
+
</div>
|
505
|
+
|
506
|
+
|
507
|
+
</div>
|
508
|
+
|
509
|
+
|
510
|
+
<div id="validator-badges">
|
511
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
512
|
+
</div>
|
513
|
+
|
514
|
+
</body>
|
515
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (LocalMemCache)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File ../src/ruby-binding/localmemcache.rb, line 39</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>)
|
15
|
+
<span class="ruby-identifier">o</span> = { <span class="ruby-identifier">:size_mb</span> =<span class="ruby-operator">></span> <span class="ruby-value">0</span> }.<span class="ruby-identifier">update</span>(<span class="ruby-identifier">options</span> <span class="ruby-operator">||</span> {})
|
16
|
+
<span class="ruby-identifier">_new</span>(<span class="ruby-identifier">o</span>);
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>clear_namespace (LocalMemCache)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File ../src/ruby-binding/localmemcache.rb, line 57</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">clear_namespace</span>(<span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">repair</span> = <span class="ruby-keyword kw">false</span>)
|
15
|
+
<span class="ruby-identifier">clear</span> <span class="ruby-identifier">:namespace</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">:repair</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">repair</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>check_namespace (LocalMemCache)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File ../src/ruby-binding/localmemcache.rb, line 72</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">check_namespace</span>(<span class="ruby-identifier">namespace</span>)
|
15
|
+
<span class="ruby-identifier">check</span> <span class="ruby-identifier">:namespace</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">to_s</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>clear (LocalMemCache)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre>/*
|
14
|
+
* call-seq: LocalMemCache.clear(*args)
|
15
|
+
*
|
16
|
+
* Deletes a memory pool. If the :repair option is set, locked semaphores are
|
17
|
+
* removed as well.
|
18
|
+
*
|
19
|
+
* WARNING: Do only call this method with the :repair option if you are sure
|
20
|
+
* that you really want to remove this memory pool and no more processes are
|
21
|
+
* still using it.
|
22
|
+
*
|
23
|
+
* If you delete a pool and other processes still have handles open on it, the
|
24
|
+
* status of these handles becomes undefined. There's no way for a process to
|
25
|
+
* know when a handle is not valid anymore, so only delete a memory pool if
|
26
|
+
* you are sure that all handles are closed.
|
27
|
+
*
|
28
|
+
* valid options for clear are
|
29
|
+
* [:namespace]
|
30
|
+
* [:filename]
|
31
|
+
* [:repair]
|
32
|
+
*
|
33
|
+
* The memory pool must be specified by either setting the :filename or
|
34
|
+
* :namespace option. The default for :repair is false.
|
35
|
+
*/
|
36
|
+
static VALUE LocalMemCache__clear(VALUE klass, VALUE o) {
|
37
|
+
</pre>
|
38
|
+
</body>
|
39
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>check (LocalMemCache)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre>/*
|
14
|
+
* call-seq: LocalMemCache.check(*args)
|
15
|
+
*
|
16
|
+
* Tries to repair a corrupt namespace. Usually one doesn't call this method
|
17
|
+
* directly, it's invoked automatically when operations time out.
|
18
|
+
*
|
19
|
+
* valid options are
|
20
|
+
* [:namespace]
|
21
|
+
* [:filename]
|
22
|
+
*
|
23
|
+
* The memory pool must be specified by either setting the :filename or
|
24
|
+
* :namespace option.
|
25
|
+
*/
|
26
|
+
static VALUE LocalMemCache__check(VALUE klass, VALUE o) {
|
27
|
+
</pre>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>get (LocalMemCache)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre>/*
|
14
|
+
* call-seq:
|
15
|
+
* lmc.get(key) -> string value or nil
|
16
|
+
* lmc[key] -> string value or nil
|
17
|
+
*
|
18
|
+
* Retrieve string value from hashtable.
|
19
|
+
*/
|
20
|
+
static VALUE LocalMemCache__get(VALUE obj, VALUE key) {
|
21
|
+
</pre>
|
22
|
+
</body>
|
23
|
+
</html>
|