localmemcache 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/README +18 -11
  2. data/Rakefile +22 -7
  3. data/VERSION +1 -1
  4. data/bench/common.rb +7 -0
  5. data/bench/gdbm_vs_lmc +10 -0
  6. data/bench/gdbm_vs_lmc.rb +29 -0
  7. data/bench/lmc_bench +11 -0
  8. data/bench/lmc_bench.rb +27 -0
  9. data/bench/memcached_bench +8 -0
  10. data/bench/memcached_bench.rb +19 -0
  11. data/bench/tyrant_bench +10 -0
  12. data/bench/tyrant_bench.rb +19 -0
  13. data/example/hello.c +1 -1
  14. data/site/doc/classes/LocalMemCache/ArgError.html +113 -0
  15. data/site/doc/classes/LocalMemCache/InitError.html +113 -0
  16. data/site/doc/classes/LocalMemCache/LocalMemCacheError.html +111 -0
  17. data/site/doc/classes/LocalMemCache/LockError.html +113 -0
  18. data/site/doc/classes/LocalMemCache/LockTimedOut.html +113 -0
  19. data/site/doc/classes/LocalMemCache/MemoryPoolClosed.html +113 -0
  20. data/site/doc/classes/LocalMemCache/MemoryPoolFull.html +113 -0
  21. data/site/doc/classes/LocalMemCache/OutOfMemoryError.html +113 -0
  22. data/site/doc/classes/LocalMemCache/RecoveryFailed.html +113 -0
  23. data/site/doc/classes/LocalMemCache/ShmError.html +113 -0
  24. data/site/doc/classes/LocalMemCache/ShmLockFailed.html +113 -0
  25. data/site/doc/classes/LocalMemCache/ShmUnlockFailed.html +113 -0
  26. data/site/doc/classes/LocalMemCache.html +515 -0
  27. data/site/doc/classes/LocalMemCache.src/M000001.html +19 -0
  28. data/site/doc/classes/LocalMemCache.src/M000002.html +18 -0
  29. data/site/doc/classes/LocalMemCache.src/M000003.html +18 -0
  30. data/site/doc/classes/LocalMemCache.src/M000004.html +39 -0
  31. data/site/doc/classes/LocalMemCache.src/M000005.html +29 -0
  32. data/site/doc/classes/LocalMemCache.src/M000006.html +23 -0
  33. data/site/doc/classes/LocalMemCache.src/M000007.html +23 -0
  34. data/site/doc/classes/LocalMemCache.src/M000008.html +22 -0
  35. data/site/doc/classes/LocalMemCache.src/M000009.html +24 -0
  36. data/site/doc/classes/LocalMemCache.src/M000010.html +24 -0
  37. data/site/doc/classes/LocalMemCache.src/M000011.html +22 -0
  38. data/site/doc/classes/LocalMemCache.src/M000012.html +22 -0
  39. data/site/doc/created.rid +1 -0
  40. data/site/doc/files/__/src/ruby-binding/extconf_rb.html +108 -0
  41. data/site/doc/files/__/src/ruby-binding/localmemcache_rb.html +108 -0
  42. data/site/doc/files/__/src/ruby-binding/rblocalmemcache_c.html +101 -0
  43. data/site/doc/fr_class_index.html +39 -0
  44. data/site/doc/fr_file_index.html +28 -0
  45. data/site/doc/fr_method_index.html +38 -0
  46. data/site/doc/index.html +24 -0
  47. data/site/doc/rdoc-style.css +208 -0
  48. data/site/index.html +50 -46
  49. data/src/lmc_common.c +22 -0
  50. data/src/lmc_common.h +4 -0
  51. data/src/lmc_hashtable.h +1 -1
  52. data/src/lmc_lock.c +17 -3
  53. data/src/lmc_shm.c +4 -2
  54. data/src/lmc_valloc.c +6 -5
  55. data/src/lmc_valloc.h +1 -0
  56. data/src/localmemcache.c +56 -35
  57. data/src/localmemcache.h +161 -4
  58. data/src/ruby-binding/localmemcache.rb +48 -16
  59. data/src/ruby-binding/rblocalmemcache.c +131 -24
  60. data/src/tests/bench.rb +1 -1
  61. data/src/tests/lmc.rb +11 -2
  62. metadata +48 -7
  63. data/INTERNALS +0 -26
  64. data/example/hello.bin +0 -0
data/src/tests/bench.rb CHANGED
@@ -18,7 +18,7 @@ def compare_speed(n)
18
18
  $lm2.get(r)
19
19
  }
20
20
 
21
- puts "builtin"
21
+ puts "Ruby Hash of Strings"
22
22
  $hh = {}
23
23
  measure_time(n) {
24
24
  r = rand(10000).to_s
data/src/tests/lmc.rb CHANGED
@@ -10,7 +10,7 @@ LocalMemCache.clear_namespace("test", true)
10
10
  $lm = LocalMemCache.new :namespace=>"test"
11
11
 
12
12
  LocalMemCache.clear_namespace("test-small", true)
13
- $lms = LocalMemCache.new :namespace=>"test-small", :size_mb => 0.01;
13
+ $lms = LocalMemCache.new :namespace=>"test-small", :size_mb => 0.20;
14
14
 
15
15
  describe 'LocalMemCache' do
16
16
 
@@ -49,7 +49,7 @@ describe 'LocalMemCache' do
49
49
 
50
50
  it 'should throw exception if pool is full' do
51
51
  $lms["one"] = "a";
52
- should.raise(LocalMemCache::MemoryPoolFull) { $lms["two"] = "b" * 8000; }
52
+ should.raise(LocalMemCache::MemoryPoolFull) { $lms["two"] = "b" * 8000000; }
53
53
  end
54
54
 
55
55
  it 'should support checking of namespaces' do
@@ -60,6 +60,15 @@ describe 'LocalMemCache' do
60
60
  LocalMemCache.clear_namespace("test")
61
61
  end
62
62
 
63
+ it 'should support filename parameters' do
64
+ lm = LocalMemCache.new :filename => ".tmp.a.lmc"
65
+ lm[:boo] = 1
66
+ lm.keys.size.should.equal 1
67
+ File.exists?(".tmp.a.lmc").should.be.true
68
+ LocalMemCache.check :filename => ".tmp.a.lmc"
69
+ LocalMemCache.clear :filename => ".tmp.a.lmc"
70
+ end
71
+
63
72
 
64
73
  end
65
74
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localmemcache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven C. Koehler
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-06 00:00:00 +00:00
12
+ date: 2009-04-17 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description: Localmemcache aims to be faster than using memcached locally by using shared memory, but providing a similar interface.
16
+ description: Localmemcache is a library for C and ruby that aims to provide an interface similar to memcached but for accessing local data instead of remote data. It's based on mmap()'ed shared memory for maximum speed. Since version 0.3.0 it supports persistence, also making it a fast alternative to GDBM and Berkeley DB.
17
17
  email: schween@snafu.de
18
18
  executables: []
19
19
 
@@ -26,7 +26,6 @@ files:
26
26
  - .gitignore
27
27
  - AUTHORS
28
28
  - COPYING
29
- - INTERNALS
30
29
  - LICENSE
31
30
  - Makefile.in
32
31
  - README
@@ -34,13 +33,55 @@ files:
34
33
  - THANKS
35
34
  - VERSION
36
35
  - aclocal.m4
36
+ - bench/common.rb
37
+ - bench/gdbm_vs_lmc
38
+ - bench/gdbm_vs_lmc.rb
39
+ - bench/lmc_bench
40
+ - bench/lmc_bench.rb
41
+ - bench/memcached_bench
42
+ - bench/memcached_bench.rb
43
+ - bench/tyrant_bench
44
+ - bench/tyrant_bench.rb
37
45
  - configure
38
46
  - configure.in
39
47
  - example/compile.sh
40
48
  - example/hello
41
- - example/hello.bin
42
49
  - example/hello.c
43
50
  - example/hello.rb
51
+ - site/doc/classes/LocalMemCache.html
52
+ - site/doc/classes/LocalMemCache.src/M000001.html
53
+ - site/doc/classes/LocalMemCache.src/M000002.html
54
+ - site/doc/classes/LocalMemCache.src/M000003.html
55
+ - site/doc/classes/LocalMemCache.src/M000004.html
56
+ - site/doc/classes/LocalMemCache.src/M000005.html
57
+ - site/doc/classes/LocalMemCache.src/M000006.html
58
+ - site/doc/classes/LocalMemCache.src/M000007.html
59
+ - site/doc/classes/LocalMemCache.src/M000008.html
60
+ - site/doc/classes/LocalMemCache.src/M000009.html
61
+ - site/doc/classes/LocalMemCache.src/M000010.html
62
+ - site/doc/classes/LocalMemCache.src/M000011.html
63
+ - site/doc/classes/LocalMemCache.src/M000012.html
64
+ - site/doc/classes/LocalMemCache/ArgError.html
65
+ - site/doc/classes/LocalMemCache/InitError.html
66
+ - site/doc/classes/LocalMemCache/LocalMemCacheError.html
67
+ - site/doc/classes/LocalMemCache/LockError.html
68
+ - site/doc/classes/LocalMemCache/LockTimedOut.html
69
+ - site/doc/classes/LocalMemCache/MemoryPoolClosed.html
70
+ - site/doc/classes/LocalMemCache/MemoryPoolFull.html
71
+ - site/doc/classes/LocalMemCache/OutOfMemoryError.html
72
+ - site/doc/classes/LocalMemCache/RecoveryFailed.html
73
+ - site/doc/classes/LocalMemCache/ShmError.html
74
+ - site/doc/classes/LocalMemCache/ShmLockFailed.html
75
+ - site/doc/classes/LocalMemCache/ShmUnlockFailed.html
76
+ - site/doc/created.rid
77
+ - site/doc/files/__/src/ruby-binding/extconf_rb.html
78
+ - site/doc/files/__/src/ruby-binding/localmemcache_rb.html
79
+ - site/doc/files/__/src/ruby-binding/rblocalmemcache_c.html
80
+ - site/doc/fr_class_index.html
81
+ - site/doc/fr_file_index.html
82
+ - site/doc/fr_method_index.html
83
+ - site/doc/index.html
84
+ - site/doc/rdoc-style.css
44
85
  - site/index.html
45
86
  - site/style.css
46
87
  - src/Makefile.in
@@ -87,7 +128,7 @@ files:
87
128
  - src/tests/ttalloc.rb
88
129
  - src/tests/ttlmc
89
130
  - src/tests/ttlmc.rb
90
- has_rdoc: false
131
+ has_rdoc: true
91
132
  homepage: http://localmemcache.rubyforge.org/
92
133
  post_install_message:
93
134
  rdoc_options: []
@@ -112,6 +153,6 @@ rubyforge_project: localmemcache
112
153
  rubygems_version: 1.2.0
113
154
  signing_key:
114
155
  specification_version: 2
115
- summary: The beauty of memcached. For local data. Blazingly fast
156
+ summary: A persistent key-value database based on mmap()'ed shared memory.
116
157
  test_files: []
117
158
 
data/INTERNALS DELETED
@@ -1,26 +0,0 @@
1
- How localmemcache works
2
- =======================
3
-
4
- localmemcache is essentially three components:
5
-
6
- - a wrapper around mmap()
7
- - an allocator that works with relative memory addresses (replaces malloc(), etc.)
8
- - hashtable data type
9
-
10
- Namespace life-cycle
11
- ====================
12
-
13
- | $lm = LocalMemCache.new :namespace => :viewcounters #, :size_mb => 1024
14
-
15
- Namespaces reside as memory-mapped files in /var/tmp/localmemcache. If the
16
- namespace does not yet exist, it is created with a default size of 1GB. It is
17
- not possible to resize a namespace, so choose a size that will be enough to
18
- hold all your data. The class method clear_namespace can be used to delete
19
- namespaces. You should also use this function in case your namespace becomes
20
- inconsistent. Note that just deleting the memory-mapped file is not enough.
21
-
22
- The default size of a namespace is 1GB, it can be changed by passing the option
23
- :size_mb to the constructor. Note that this is the maximum size of the shared
24
- memory segment which cannot be extended later without clearing the namespace
25
- first. Setting large sizes shouldn't be much of a problem since only that
26
- memory which is really used will exist in physical ram and disk.
data/example/hello.bin DELETED
Binary file