cachy 0.2.0 → 0.2.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/VERSION +1 -1
- data/cachy.gemspec +3 -4
- data/lib/cachy.rb +5 -1
- data/spec/cachy_spec.rb +18 -1
- metadata +14 -14
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.1
|
data/cachy.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{cachy}
|
|
8
|
-
s.version = "0.2.
|
|
8
|
+
s.version = "0.2.1"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Michael Grosser"]
|
|
12
|
-
s.date = %q{
|
|
12
|
+
s.date = %q{2011-06-17}
|
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
|
14
14
|
s.files = [
|
|
15
15
|
"Gemfile",
|
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
|
35
35
|
]
|
|
36
36
|
s.homepage = %q{http://github.com/grosser/cachy}
|
|
37
37
|
s.require_paths = ["lib"]
|
|
38
|
-
s.rubygems_version = %q{1.
|
|
38
|
+
s.rubygems_version = %q{1.6.2}
|
|
39
39
|
s.summary = %q{Caching library for projects that have many processes or many caches}
|
|
40
40
|
s.test_files = [
|
|
41
41
|
"spec/cachy/memcache_timeout_protection_spec.rb",
|
|
@@ -49,7 +49,6 @@ Gem::Specification.new do |s|
|
|
|
49
49
|
]
|
|
50
50
|
|
|
51
51
|
if s.respond_to? :specification_version then
|
|
52
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
53
52
|
s.specification_version = 3
|
|
54
53
|
|
|
55
54
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/cachy.rb
CHANGED
|
@@ -38,6 +38,10 @@ class Cachy
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
def self.get(*args)
|
|
42
|
+
cache_store.read(key(*args))
|
|
43
|
+
end
|
|
44
|
+
|
|
41
45
|
# Constructs a cache-key (first argument must be a String/Symbol)
|
|
42
46
|
#
|
|
43
47
|
# Cachy.key :my_key
|
|
@@ -244,4 +248,4 @@ class Cachy
|
|
|
244
248
|
end
|
|
245
249
|
end
|
|
246
250
|
|
|
247
|
-
Cachy.cache_store = ActionController::Base.cache_store if defined? ActionController::Base
|
|
251
|
+
Cachy.cache_store = ActionController::Base.cache_store if defined? ActionController::Base
|
data/spec/cachy_spec.rb
CHANGED
|
@@ -73,6 +73,23 @@ describe Cachy do
|
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
+
describe :get do
|
|
77
|
+
it "gets back an object" do
|
|
78
|
+
Cachy.cache(:foo){'xxx'}
|
|
79
|
+
Cachy.get(:foo).should == 'xxx'
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it "gets complex key" do
|
|
83
|
+
Cachy.cache(:foo, 1){'xxx'}
|
|
84
|
+
Cachy.get(:foo).should == nil
|
|
85
|
+
Cachy.get(:foo, 1).should == 'xxx'
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "gets back nil" do
|
|
89
|
+
Cachy.get(:bar).should == nil
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
76
93
|
describe :expire do
|
|
77
94
|
it "expires the cache for all languages" do
|
|
78
95
|
Cachy.cache(:my_key){ "without_locale" }
|
|
@@ -356,4 +373,4 @@ describe Cachy do
|
|
|
356
373
|
Cachy.key_versions.key?(:xxx).should == false
|
|
357
374
|
end
|
|
358
375
|
end
|
|
359
|
-
end
|
|
376
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cachy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 21
|
|
5
|
+
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
|
-
-
|
|
10
|
-
version: 0.2.
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.2.1
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Michael Grosser
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date:
|
|
18
|
+
date: 2011-06-17 00:00:00 +02:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -28,10 +28,10 @@ dependencies:
|
|
|
28
28
|
segments:
|
|
29
29
|
- 0
|
|
30
30
|
version: "0"
|
|
31
|
-
name: mini_memory_store
|
|
32
|
-
prerelease: false
|
|
33
31
|
type: :runtime
|
|
32
|
+
name: mini_memory_store
|
|
34
33
|
version_requirements: *id001
|
|
34
|
+
prerelease: false
|
|
35
35
|
- !ruby/object:Gem::Dependency
|
|
36
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
|
37
37
|
none: false
|
|
@@ -42,10 +42,10 @@ dependencies:
|
|
|
42
42
|
segments:
|
|
43
43
|
- 0
|
|
44
44
|
version: "0"
|
|
45
|
-
name: rake
|
|
46
|
-
prerelease: false
|
|
47
45
|
type: :development
|
|
46
|
+
name: rake
|
|
48
47
|
version_requirements: *id002
|
|
48
|
+
prerelease: false
|
|
49
49
|
- !ruby/object:Gem::Dependency
|
|
50
50
|
requirement: &id003 !ruby/object:Gem::Requirement
|
|
51
51
|
none: false
|
|
@@ -56,10 +56,10 @@ dependencies:
|
|
|
56
56
|
segments:
|
|
57
57
|
- 2
|
|
58
58
|
version: "2"
|
|
59
|
-
name: rspec
|
|
60
|
-
prerelease: false
|
|
61
59
|
type: :development
|
|
60
|
+
name: rspec
|
|
62
61
|
version_requirements: *id003
|
|
62
|
+
prerelease: false
|
|
63
63
|
- !ruby/object:Gem::Dependency
|
|
64
64
|
requirement: &id004 !ruby/object:Gem::Requirement
|
|
65
65
|
none: false
|
|
@@ -70,10 +70,10 @@ dependencies:
|
|
|
70
70
|
segments:
|
|
71
71
|
- 0
|
|
72
72
|
version: "0"
|
|
73
|
-
name: jeweler
|
|
74
|
-
prerelease: false
|
|
75
73
|
type: :development
|
|
74
|
+
name: jeweler
|
|
76
75
|
version_requirements: *id004
|
|
76
|
+
prerelease: false
|
|
77
77
|
description:
|
|
78
78
|
email: grosser.michael@gmail.com
|
|
79
79
|
executables: []
|
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
133
133
|
requirements: []
|
|
134
134
|
|
|
135
135
|
rubyforge_project:
|
|
136
|
-
rubygems_version: 1.
|
|
136
|
+
rubygems_version: 1.6.2
|
|
137
137
|
signing_key:
|
|
138
138
|
specification_version: 3
|
|
139
139
|
summary: Caching library for projects that have many processes or many caches
|