localmemcache 0.3.0 → 0.4.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.
Files changed (65) hide show
  1. data/README +5 -2
  2. data/Rakefile +4 -0
  3. data/VERSION +1 -1
  4. data/bench/lmc_bench.rb +1 -1
  5. data/bench/tokyo_cabinet_bench +3 -0
  6. data/bench/tokyo_cabinet_bench.rb +20 -0
  7. data/site/doc/classes/LocalMemCache.html +146 -129
  8. data/site/doc/classes/LocalMemCache.src/M000001.html +1 -1
  9. data/site/doc/classes/LocalMemCache.src/M000002.html +26 -5
  10. data/site/doc/classes/LocalMemCache.src/M000003.html +16 -5
  11. data/site/doc/classes/LocalMemCache.src/M000004.html +7 -23
  12. data/site/doc/classes/LocalMemCache.src/M000005.html +7 -13
  13. data/site/doc/classes/LocalMemCache.src/M000006.html +4 -5
  14. data/site/doc/classes/LocalMemCache.src/M000007.html +6 -5
  15. data/site/doc/classes/LocalMemCache.src/M000008.html +6 -6
  16. data/site/doc/classes/LocalMemCache.src/M000009.html +1 -1
  17. data/site/doc/classes/LocalMemCache.src/M000010.html +4 -6
  18. data/site/doc/classes/LocalMemCache.src/M000011.html +4 -4
  19. data/site/doc/classes/LocalMemCache.src/M000012.html +4 -4
  20. data/site/doc/classes/LocalMemCache/ArgError.html +2 -2
  21. data/site/doc/classes/LocalMemCache/InitError.html +2 -2
  22. data/site/doc/classes/LocalMemCache/LocalMemCacheError.html +2 -2
  23. data/site/doc/classes/LocalMemCache/LockError.html +2 -2
  24. data/site/doc/classes/LocalMemCache/LockTimedOut.html +2 -2
  25. data/site/doc/classes/LocalMemCache/MemoryPoolClosed.html +2 -2
  26. data/site/doc/classes/LocalMemCache/MemoryPoolFull.html +2 -2
  27. data/site/doc/classes/LocalMemCache/OutOfMemoryError.html +2 -2
  28. data/site/doc/classes/LocalMemCache/RecoveryFailed.html +2 -2
  29. data/site/doc/classes/LocalMemCache/ShmError.html +2 -2
  30. data/site/doc/classes/LocalMemCache/ShmLockFailed.html +2 -2
  31. data/site/doc/classes/LocalMemCache/ShmUnlockFailed.html +2 -2
  32. data/site/doc/created.rid +1 -1
  33. data/site/doc/fr_class_index.html +2 -0
  34. data/site/doc/fr_file_index.html +3 -2
  35. data/site/doc/fr_method_index.html +17 -11
  36. data/site/doc/index.html +1 -1
  37. data/site/index.html +33 -17
  38. data/src/lmc_common.c +2 -1
  39. data/src/lmc_common.h +1 -1
  40. data/src/lmc_hashtable.c +62 -2
  41. data/src/lmc_hashtable.h +4 -1
  42. data/src/lmc_shm.c +1 -3
  43. data/src/lmc_shm.h +1 -3
  44. data/src/lmc_valloc.c +5 -0
  45. data/src/lmc_valloc.h +1 -0
  46. data/src/localmemcache.c +43 -8
  47. data/src/localmemcache.h +24 -6
  48. data/src/ruby-binding/localmemcache.rb +14 -29
  49. data/src/ruby-binding/rblocalmemcache.c +127 -16
  50. data/src/tests/allocfailure.rb +1 -1
  51. data/src/tests/bench.rb +1 -1
  52. data/src/tests/bench_keys.rb +1 -1
  53. data/src/tests/crash.rb +1 -1
  54. data/src/tests/lmc.rb +65 -9
  55. data/src/tests/lmctestapi.c +1 -1
  56. data/src/tests/parallelwrite.rb +1 -1
  57. data/src/tests/ttkeys +10 -0
  58. data/src/tests/ttkeys.rb +35 -0
  59. data/src/tests/ttlmc.rb +24 -6
  60. data/src/tests/ttrandom_pair +10 -0
  61. data/src/tests/ttrandom_pair.rb +23 -0
  62. metadata +8 -5
  63. data/site/doc/files/__/src/ruby-binding/extconf_rb.html +0 -108
  64. data/site/doc/files/__/src/ruby-binding/localmemcache_rb.html +0 -108
  65. data/site/doc/files/__/src/ruby-binding/rblocalmemcache_c.html +0 -101
@@ -10,7 +10,7 @@
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File ../src/ruby-binding/localmemcache.rb, line 39</span>
13
+ <pre><span class="ruby-comment cmt"># File localmemcache.rb, line 40</span>
14
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
15
  <span class="ruby-identifier">o</span> = { <span class="ruby-identifier">:size_mb</span> =<span class="ruby-operator">&gt;</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
16
  <span class="ruby-identifier">_new</span>(<span class="ruby-identifier">o</span>);
@@ -5,14 +5,35 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>clear_namespace (LocalMemCache)</title>
8
+ <title>drop (LocalMemCache)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
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">&gt;</span> <span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">:repair</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">repair</span>
16
- <span class="ruby-keyword kw">end</span></pre>
13
+ <pre>/*
14
+ * call-seq: LocalMemCache.drop(*args)
15
+ *
16
+ * Deletes a memory pool. If the :force option is set, locked semaphores are
17
+ * removed as well.
18
+ *
19
+ * WARNING: Do only call this method with the :force 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 drop are
29
+ * [:namespace]
30
+ * [:filename]
31
+ * [:force]
32
+ *
33
+ * The memory pool must be specified by either setting the :filename or
34
+ * :namespace option. The default for :force is false.
35
+ */
36
+ static VALUE LocalMemCache__drop(VALUE klass, VALUE o) {
37
+ </pre>
17
38
  </body>
18
39
  </html>
@@ -5,14 +5,25 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>check_namespace (LocalMemCache)</title>
8
+ <title>check (LocalMemCache)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
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">&gt;</span> <span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">to_s</span>
16
- <span class="ruby-keyword kw">end</span></pre>
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>
17
28
  </body>
18
29
  </html>
@@ -5,35 +5,19 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>clear (LocalMemCache)</title>
8
+ <title>get (LocalMemCache)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre>/*
14
- * call-seq: LocalMemCache.clear(*args)
13
+ <pre>/*
14
+ * call-seq:
15
+ * lmc.get(key) -&gt; string value or nil
16
+ * lmc[key] -&gt; string value or nil
15
17
  *
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.
18
+ * Retrieve string value from hashtable.
35
19
  */
36
- static VALUE LocalMemCache__clear(VALUE klass, VALUE o) {
20
+ static VALUE LocalMemCache__get(VALUE obj, VALUE key) {
37
21
  </pre>
38
22
  </body>
39
23
  </html>
@@ -5,25 +5,19 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>check (LocalMemCache)</title>
8
+ <title>[] (LocalMemCache)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre>/*
14
- * call-seq: LocalMemCache.check(*args)
13
+ <pre>/*
14
+ * call-seq:
15
+ * lmc.get(key) -&gt; string value or nil
16
+ * lmc[key] -&gt; string value or nil
15
17
  *
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.
18
+ * Retrieve string value from hashtable.
25
19
  */
26
- static VALUE LocalMemCache__check(VALUE klass, VALUE o) {
20
+ static VALUE LocalMemCache__get(VALUE obj, VALUE key) {
27
21
  </pre>
28
22
  </body>
29
23
  </html>
@@ -5,19 +5,18 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>get (LocalMemCache)</title>
8
+ <title>delete (LocalMemCache)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
13
  <pre>/*
14
14
  * call-seq:
15
- * lmc.get(key) -&gt; string value or nil
16
- * lmc[key] -&gt; string value or nil
15
+ * lmc.delete(key) -&gt; Qnil
17
16
  *
18
- * Retrieve string value from hashtable.
17
+ * Deletes key from hashtable. The key is converted to string.
19
18
  */
20
- static VALUE LocalMemCache__get(VALUE obj, VALUE key) {
19
+ static VALUE LocalMemCache__delete(VALUE obj, VALUE key) {
21
20
  </pre>
22
21
  </body>
23
22
  </html>
@@ -5,19 +5,20 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>[] (LocalMemCache)</title>
8
+ <title>set (LocalMemCache)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
13
  <pre>/*
14
14
  * call-seq:
15
- * lmc.get(key) -&gt; string value or nil
16
- * lmc[key] -&gt; string value or nil
15
+ * lmc.set(key, value) -&gt; Qnil
16
+ * lmc[key]=value -&gt; Qnil
17
17
  *
18
- * Retrieve string value from hashtable.
18
+ * Set value for key in hashtable. Value and key will be converted to
19
+ * string.
19
20
  */
20
- static VALUE LocalMemCache__get(VALUE obj, VALUE key) {
21
+ static VALUE LocalMemCache__set(VALUE obj, VALUE key, VALUE value) {
21
22
  </pre>
22
23
  </body>
23
24
  </html>
@@ -5,18 +5,18 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>delete (LocalMemCache)</title>
8
+ <title>clear (LocalMemCache)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
- <pre>/*
14
- * call-seq:
15
- * lmc.delete(key) -&gt; Qnil
13
+ <pre>/*
14
+ * call-seq:
15
+ * lmc.clear -&gt; Qnil
16
16
  *
17
- * Deletes key from hashtable. The key is converted to string.
17
+ * Clears content of hashtable.
18
18
  */
19
- static VALUE LocalMemCache__delete(VALUE obj, VALUE key) {
19
+ static VALUE LocalMemCache__clear(VALUE obj) {
20
20
  </pre>
21
21
  </body>
22
22
  </html>
@@ -5,7 +5,7 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>set (LocalMemCache)</title>
8
+ <title>[]= (LocalMemCache)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
@@ -5,20 +5,18 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>[]= (LocalMemCache)</title>
8
+ <title>keys (LocalMemCache)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
13
  <pre>/*
14
14
  * call-seq:
15
- * lmc.set(key, value) -&gt; Qnil
16
- * lmc[key]=value -&gt; Qnil
15
+ * lmc.keys() -&gt; array or nil
17
16
  *
18
- * Set value for key in hashtable. Value and key will be converted to
19
- * string.
17
+ * Returns a list of keys.
20
18
  */
21
- static VALUE LocalMemCache__set(VALUE obj, VALUE key, VALUE value) {
19
+ static VALUE LocalMemCache__keys(VALUE obj) {
22
20
  </pre>
23
21
  </body>
24
22
  </html>
@@ -5,18 +5,18 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>keys (LocalMemCache)</title>
8
+ <title>each_pair (LocalMemCache)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
13
  <pre>/*
14
14
  * call-seq:
15
- * lmc.keys() -&gt; array or nil
15
+ * lmc.each_pair {|k, v| block } -&gt; nil
16
16
  *
17
- * Returns a list of keys.
17
+ * Iterates over hashtable.
18
18
  */
19
- static VALUE LocalMemCache__keys(VALUE obj) {
19
+ static VALUE LocalMemCache__each_pair(VALUE obj) {
20
20
  </pre>
21
21
  </body>
22
22
  </html>
@@ -5,18 +5,18 @@
5
5
 
6
6
  <html>
7
7
  <head>
8
- <title>close (LocalMemCache)</title>
8
+ <title>random_pair (LocalMemCache)</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
11
  </head>
12
12
  <body class="standalone-code">
13
13
  <pre>/*
14
14
  * call-seq:
15
- * lmc.close() -&gt; Qnil
15
+ * lmc.random_pair() -&gt; [key, value] or nil
16
16
  *
17
- * Releases hashtable.
17
+ * Retrieves random pair from hashtable.
18
18
  */
19
- static VALUE LocalMemCache__close(VALUE obj) {
19
+ static VALUE LocalMemCache__random_pair(VALUE obj) {
20
20
  </pre>
21
21
  </body>
22
22
  </html>
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/__/src/ruby-binding/localmemcache_rb.html">
59
- ../src/ruby-binding/localmemcache.rb
58
+ <a href="../../files/localmemcache_rb.html">
59
+ localmemcache.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/__/src/ruby-binding/localmemcache_rb.html">
59
- ../src/ruby-binding/localmemcache.rb
58
+ <a href="../../files/localmemcache_rb.html">
59
+ localmemcache.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/__/src/ruby-binding/localmemcache_rb.html">
59
- ../src/ruby-binding/localmemcache.rb
58
+ <a href="../../files/localmemcache_rb.html">
59
+ localmemcache.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/__/src/ruby-binding/localmemcache_rb.html">
59
- ../src/ruby-binding/localmemcache.rb
58
+ <a href="../../files/localmemcache_rb.html">
59
+ localmemcache.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/__/src/ruby-binding/localmemcache_rb.html">
59
- ../src/ruby-binding/localmemcache.rb
58
+ <a href="../../files/localmemcache_rb.html">
59
+ localmemcache.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/__/src/ruby-binding/localmemcache_rb.html">
59
- ../src/ruby-binding/localmemcache.rb
58
+ <a href="../../files/localmemcache_rb.html">
59
+ localmemcache.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/__/src/ruby-binding/localmemcache_rb.html">
59
- ../src/ruby-binding/localmemcache.rb
58
+ <a href="../../files/localmemcache_rb.html">
59
+ localmemcache.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/__/src/ruby-binding/localmemcache_rb.html">
59
- ../src/ruby-binding/localmemcache.rb
58
+ <a href="../../files/localmemcache_rb.html">
59
+ localmemcache.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/__/src/ruby-binding/localmemcache_rb.html">
59
- ../src/ruby-binding/localmemcache.rb
58
+ <a href="../../files/localmemcache_rb.html">
59
+ localmemcache.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/__/src/ruby-binding/localmemcache_rb.html">
59
- ../src/ruby-binding/localmemcache.rb
58
+ <a href="../../files/localmemcache_rb.html">
59
+ localmemcache.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>
@@ -55,8 +55,8 @@
55
55
  <tr class="top-aligned-row">
56
56
  <td><strong>In:</strong></td>
57
57
  <td>
58
- <a href="../../files/__/src/ruby-binding/localmemcache_rb.html">
59
- ../src/ruby-binding/localmemcache.rb
58
+ <a href="../../files/localmemcache_rb.html">
59
+ localmemcache.rb
60
60
  </a>
61
61
  <br />
62
62
  </td>