mongocached 1.0.0 → 1.0.1
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/Benchmark.md +6 -9
- data/HISTORY.md +13 -0
- data/lib/mongocached.rb +9 -2
- metadata +3 -3
data/Benchmark.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## Benchmarks
|
|
2
|
+
|
|
3
|
+
Note: This isn't expected to quite as fast as memcached, but based on these numbers, it's a viable replacement when you need shared a shared cache and do not have a ton of memory, as diskspace is cheap. If you don't need shared storeage and memory is still an issue, check out [Diskcached](https://github.com/rubyops/diskcached), [it's faster](https://github.com/rubyops/diskcached/wiki/Benchmark-Output).
|
|
4
|
+
|
|
5
|
+
|
|
1
6
|
### Ruby 1.9.3p194
|
|
2
7
|
|
|
3
8
|
mo = mongocached / me = memcached
|
|
@@ -20,15 +25,7 @@ me set 15.510000 2.340000 17.850000 ( 20.471940)
|
|
|
20
25
|
mo get 39.740000 3.350000 43.090000 ( 47.473688)
|
|
21
26
|
me get 14.950000 1.420000 16.370000 ( 17.187145)
|
|
22
27
|
</pre>
|
|
23
|
-
|
|
24
|
-
#### large hash * 100000
|
|
25
|
-
<pre>
|
|
26
|
-
user system total real
|
|
27
|
-
mo set 40.650000 1.180000 41.830000 ( 42.026839)
|
|
28
|
-
me set 16.590000 2.060000 18.650000 ( 20.909275)
|
|
29
|
-
mo get 49.400000 5.650000 55.050000 ( 63.141785)
|
|
30
|
-
me get 11.760000 1.810000 13.570000 ( 14.814693)
|
|
31
|
-
</pre>
|
|
28
|
+
|
|
32
29
|
|
|
33
30
|
### Ruby 1.9.2p318
|
|
34
31
|
|
data/HISTORY.md
CHANGED
data/lib/mongocached.rb
CHANGED
|
@@ -2,13 +2,14 @@ require 'mongo'
|
|
|
2
2
|
# @author Joshua P. Mervine <joshua@mervine.net>
|
|
3
3
|
class Mongocached
|
|
4
4
|
# version for gem
|
|
5
|
-
VERSION = '1.0.
|
|
5
|
+
VERSION = '1.0.1'
|
|
6
6
|
|
|
7
7
|
@cleanup_last = nil
|
|
8
8
|
@ensure_indexes = false
|
|
9
9
|
|
|
10
10
|
# initialize object
|
|
11
11
|
def initialize options={}
|
|
12
|
+
|
|
12
13
|
@options = defaults.merge! options
|
|
13
14
|
|
|
14
15
|
unless @options[:lifetime].nil?
|
|
@@ -186,7 +187,13 @@ class Mongocached
|
|
|
186
187
|
end
|
|
187
188
|
|
|
188
189
|
def db
|
|
189
|
-
@db
|
|
190
|
+
unless @db
|
|
191
|
+
@db = connection[@options[:dbname]]
|
|
192
|
+
if @options.has_key?(:username) and @options.has_key?(:password)
|
|
193
|
+
@db.authenticate(@options[:username], @options[:password])
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
@db
|
|
190
197
|
end
|
|
191
198
|
|
|
192
199
|
def connection
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mongocached
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -61,7 +61,7 @@ dependencies:
|
|
|
61
61
|
version: '0'
|
|
62
62
|
description: Simple mongodb based cache for things like Sinatra and Rails which is
|
|
63
63
|
implemented much like Memcached in hopes that in some cases they're interchangeable.
|
|
64
|
-
It's based off 'diskcached'.
|
|
64
|
+
It's based off 'diskcached'.
|
|
65
65
|
email:
|
|
66
66
|
- joshua@mervine.net
|
|
67
67
|
executables: []
|
|
@@ -88,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
88
88
|
version: '0'
|
|
89
89
|
segments:
|
|
90
90
|
- 0
|
|
91
|
-
hash:
|
|
91
|
+
hash: 3423716277356422672
|
|
92
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
none: false
|
|
94
94
|
requirements:
|