redis-cache 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/active_support/cache/redis_store.rb +12 -2
- metadata +2 -2
data/History.txt
CHANGED
@@ -29,16 +29,26 @@ module ActiveSupport
|
|
29
29
|
|
30
30
|
def increment(name, amount = 1, options = nil)
|
31
31
|
options = merged_options(options)
|
32
|
+
expires_in = options[:expires_in].to_i
|
32
33
|
response = instrument(:increment, name, :amount => amount) do
|
33
|
-
@redis.incrby(namespaced_key(name, options), amount)
|
34
|
+
r = @redis.incrby(namespaced_key(name, options), amount)
|
35
|
+
if expires_in > 0
|
36
|
+
@redis.expire(namespaced_key(name, options), expires_in)
|
37
|
+
end
|
38
|
+
r
|
34
39
|
end
|
35
40
|
response
|
36
41
|
end
|
37
42
|
|
38
43
|
def decrement(name, amount = 1, options = nil)
|
39
44
|
options = merged_options(options)
|
45
|
+
expires_in = options[:expires_in].to_i
|
40
46
|
response = instrument(:decrement, name, :amount => amount) do
|
41
|
-
@redis.decrby(namespaced_key(name, options), amount)
|
47
|
+
r = @redis.decrby(namespaced_key(name, options), amount)
|
48
|
+
if expires_in > 0
|
49
|
+
@redis.expire(namespaced_key(name, options), expires_in)
|
50
|
+
end
|
51
|
+
r
|
42
52
|
end
|
43
53
|
response
|
44
54
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: redis-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Anton Ageev
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-18 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|