redis-cluster-activesupport 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d16f65bf68908d725fd1f187ab7fb776fcc5eb4c
|
4
|
+
data.tar.gz: e7d53f74bd6d52e3977a1c821c512a645b9f578c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e65f8a805aa3da20be73c49af133aa87e0b046de356972a5f6be7046ad0b50f7a740c2a1a76dee2e788f5777eb559781224bec5c76b756768ea2aba95a5ac0a5
|
7
|
+
data.tar.gz: 7066b49a9d78ed73f85b73f5eb791050f8a6e70a28f9c3ecf2517be06927316310788d6ba4e80dfc0f3d8355a4818763f97e850e43a70173f48492898d04e43e
|
@@ -29,6 +29,24 @@ module ActiveSupport
|
|
29
29
|
fail ::NotImplementedError, "The default implementation uses MULTI which isn't supported. This can be changed to use MSET and work."
|
30
30
|
end
|
31
31
|
|
32
|
+
def increment(key, amount = 1, options = {})
|
33
|
+
options = merged_options(options)
|
34
|
+
ttl = _expires_in(options)
|
35
|
+
normalized_key = normalize_key(key, options)
|
36
|
+
instrument(:increment, key, :amount => amount) do
|
37
|
+
with do |c|
|
38
|
+
if ttl
|
39
|
+
c.pipelined do
|
40
|
+
c.incrby normalized_key, amount
|
41
|
+
c.expire normalized_key, ttl
|
42
|
+
end
|
43
|
+
else
|
44
|
+
c.incrby normalized_key, amount
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
32
50
|
def read_entry(key, options)
|
33
51
|
super
|
34
52
|
rescue Redis::CommandError => error
|
@@ -44,6 +62,15 @@ module ActiveSupport
|
|
44
62
|
raise if raise_errors?
|
45
63
|
false
|
46
64
|
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def _expires_in(options)
|
69
|
+
if options
|
70
|
+
# Rack::Session Merb Rails/Sinatra
|
71
|
+
options[:expire_after] || options[:expires_in] || options[:expire_in]
|
72
|
+
end
|
73
|
+
end
|
47
74
|
end
|
48
75
|
end
|
49
76
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-cluster-activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garrett Thornburg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-activesupport
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.6.13
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Extension to redis-activesupport for working with redis cluster
|