cacher 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cacher.rb +6 -6
- data/lib/cacher/version.rb +1 -1
- metadata +3 -3
data/lib/cacher.rb
CHANGED
@@ -41,8 +41,8 @@ module Cacher
|
|
41
41
|
#
|
42
42
|
# #get (or #read) - takes one argument and returns
|
43
43
|
# something from a cache.
|
44
|
-
# #set (or #write) - takes
|
45
|
-
# sets something in a cache.
|
44
|
+
# #set (or #write) - takes three arguments, a key, a value, and
|
45
|
+
# an options hash, and sets something in a cache.
|
46
46
|
attr_writer :cache
|
47
47
|
def cache
|
48
48
|
return @cache if instance_variable_defined? :@cache
|
@@ -121,7 +121,7 @@ module Cacher
|
|
121
121
|
|
122
122
|
def set(key, options={}, &blk)
|
123
123
|
val = do_block(&blk)
|
124
|
-
cache_set(key, marshal_value(val))
|
124
|
+
cache_set(key, marshal_value(val), options)
|
125
125
|
val
|
126
126
|
end
|
127
127
|
|
@@ -158,15 +158,15 @@ private
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
def cache_set(key, val)
|
161
|
+
def cache_set(key, val, options={})
|
162
162
|
return val unless enabled?
|
163
163
|
|
164
164
|
key = prepare_key(key)
|
165
165
|
|
166
166
|
if cache.respond_to? :set
|
167
|
-
cache.set(key, val)
|
167
|
+
cache.set(key, val, options)
|
168
168
|
else
|
169
|
-
cache.write(key, val)
|
169
|
+
cache.write(key, val, options)
|
170
170
|
end
|
171
171
|
|
172
172
|
val
|
data/lib/cacher/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cacher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -36,7 +36,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
36
36
|
version: '0'
|
37
37
|
segments:
|
38
38
|
- 0
|
39
|
-
hash:
|
39
|
+
hash: 3814935610056990857
|
40
40
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
45
|
version: '0'
|
46
46
|
segments:
|
47
47
|
- 0
|
48
|
-
hash:
|
48
|
+
hash: 3814935610056990857
|
49
49
|
requirements: []
|
50
50
|
rubyforge_project: cacher
|
51
51
|
rubygems_version: 1.8.10
|