dim-tokyo-cache-store 0.1.1 → 0.2.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.
- data/README +3 -3
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/active_support/cache/tokyo_store.rb +22 -8
- data/spec/tokyo_cache_store_spec.rb +4 -4
- data/tokyo-cache-store.gemspec +5 -5
- metadata +4 -4
data/README
CHANGED
@@ -13,14 +13,14 @@ Overview
|
|
13
13
|
|
14
14
|
Requirements
|
15
15
|
|
16
|
-
Tokyo Cabinet:
|
16
|
+
Tokyo Cabinet:
|
17
17
|
http://1978th.net/tokyocabinet/
|
18
18
|
|
19
19
|
Tokyo Tyrant:
|
20
20
|
http://1978th.net/tokyotyrant/
|
21
21
|
|
22
|
-
|
23
|
-
sudo gem install
|
22
|
+
Ruby Bindings:
|
23
|
+
sudo gem install rufus-tokyo
|
24
24
|
|
25
25
|
Installation
|
26
26
|
|
data/Rakefile
CHANGED
@@ -19,7 +19,7 @@ begin
|
|
19
19
|
spec.authors = ["Dimitrij Denissenko"]
|
20
20
|
spec.test_files = Dir.glob('spec/**')
|
21
21
|
spec.add_dependency('activesupport', '>= 2.3.0')
|
22
|
-
spec.add_dependency('
|
22
|
+
spec.add_dependency('rufus-tokyo', '>= 1.0.1')
|
23
23
|
end
|
24
24
|
rescue LoadError
|
25
25
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -1,26 +1,40 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
begin
|
2
|
+
gem 'actsasflinn-ruby-tokyotyrant', '>= 0.2.0'
|
3
|
+
require 'tokyo_tyrant'
|
4
|
+
rescue LoadError
|
5
|
+
begin
|
6
|
+
require 'rufus/tokyo/tyrant'
|
7
|
+
rescue LoadError
|
8
|
+
warn "\n WARNING: Unable to find required tokyo tyrant libraries."
|
9
|
+
warn " Please install the rufus-tokyo GEM - sudo gem install rufus-tokyo\n"
|
10
|
+
raise
|
11
|
+
end
|
12
|
+
end
|
3
13
|
|
4
14
|
module ActiveSupport
|
5
15
|
module Cache
|
6
16
|
class TokyoStore < Store
|
7
17
|
|
8
|
-
def initialize(host = '
|
18
|
+
def initialize(host = '127.0.0.1', port = 1978)
|
9
19
|
super()
|
10
|
-
@data =
|
20
|
+
@data = if Object.const_defined?(:TokyoTyrant)
|
21
|
+
TokyoTyrant::DB.new(host, port)
|
22
|
+
else
|
23
|
+
Rufus::Tokyo::Tyrant.new(host, port)
|
24
|
+
end
|
11
25
|
end
|
12
26
|
|
13
27
|
def read(key, options = nil)
|
14
28
|
super
|
15
29
|
@data[key]
|
16
|
-
rescue
|
30
|
+
rescue
|
17
31
|
nil
|
18
32
|
end
|
19
33
|
|
20
34
|
def write(key, value, options = nil)
|
21
35
|
super
|
22
36
|
@data[key] = value
|
23
|
-
rescue
|
37
|
+
rescue
|
24
38
|
nil
|
25
39
|
end
|
26
40
|
|
@@ -31,12 +45,12 @@ module ActiveSupport
|
|
31
45
|
|
32
46
|
def delete_matched(matcher, options = nil)
|
33
47
|
super
|
34
|
-
@data.
|
48
|
+
@data.keys.each { |k| @data.delete(k) if k =~ matcher }
|
35
49
|
end
|
36
50
|
|
37
51
|
def exist?(key, options = nil)
|
38
52
|
super
|
39
|
-
@data.
|
53
|
+
not @data[key].nil?
|
40
54
|
end
|
41
55
|
|
42
56
|
def clear
|
@@ -11,7 +11,7 @@ describe ActiveSupport::Cache::TokyoStore do
|
|
11
11
|
|
12
12
|
before :all do
|
13
13
|
`tchmgr create #{DB_FILE.to_str}`
|
14
|
-
`ttserver -dmn -le -pid #{PID_FILE.to_str} #{DB_FILE.to_str}`
|
14
|
+
`ttserver -dmn -le -port 45000 -pid #{PID_FILE.to_str} #{DB_FILE.to_str}`
|
15
15
|
end
|
16
16
|
|
17
17
|
after :all do
|
@@ -26,7 +26,7 @@ describe ActiveSupport::Cache::TokyoStore do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
before do
|
29
|
-
@store = ActiveSupport::Cache::TokyoStore.new
|
29
|
+
@store = ActiveSupport::Cache::TokyoStore.new('127.0.0.1', 45000)
|
30
30
|
@store.clear
|
31
31
|
write 'A', 'B'
|
32
32
|
end
|
@@ -41,8 +41,8 @@ describe ActiveSupport::Cache::TokyoStore do
|
|
41
41
|
@store.write 'C', 'Plan C'
|
42
42
|
@store.read('C').should == 'Plan C'
|
43
43
|
|
44
|
-
@store.delete('A').should
|
45
|
-
@store.delete('D').should
|
44
|
+
@store.delete('A').should == 'Plan A'
|
45
|
+
@store.delete('D').should be_nil
|
46
46
|
@store.read('A').should be_nil
|
47
47
|
end
|
48
48
|
|
data/tokyo-cache-store.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{tokyo-cache-store}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dimitrij Denissenko"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-20}
|
13
13
|
s.description = %q{Tokyo Tyrant cache store for ActiveSupport/Rails.}
|
14
14
|
s.email = %q{contact@dvisionfactory.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -42,13 +42,13 @@ Gem::Specification.new do |s|
|
|
42
42
|
|
43
43
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
44
44
|
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.0"])
|
45
|
-
s.add_runtime_dependency(%q<
|
45
|
+
s.add_runtime_dependency(%q<rufus-tokyo>, [">= 1.0.1"])
|
46
46
|
else
|
47
47
|
s.add_dependency(%q<activesupport>, [">= 2.3.0"])
|
48
|
-
s.add_dependency(%q<
|
48
|
+
s.add_dependency(%q<rufus-tokyo>, [">= 1.0.1"])
|
49
49
|
end
|
50
50
|
else
|
51
51
|
s.add_dependency(%q<activesupport>, [">= 2.3.0"])
|
52
|
-
s.add_dependency(%q<
|
52
|
+
s.add_dependency(%q<rufus-tokyo>, [">= 1.0.1"])
|
53
53
|
end
|
54
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dim-tokyo-cache-store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitrij Denissenko
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-20 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -23,14 +23,14 @@ dependencies:
|
|
23
23
|
version: 2.3.0
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
26
|
+
name: rufus-tokyo
|
27
27
|
type: :runtime
|
28
28
|
version_requirement:
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 1.0.1
|
34
34
|
version:
|
35
35
|
description: Tokyo Tyrant cache store for ActiveSupport/Rails.
|
36
36
|
email: contact@dvisionfactory.com
|