dalli 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of dalli might be problematic. Click here for more details.
- data/History.md +8 -2
- data/lib/active_support/cache/dalli_store.rb +17 -9
- data/lib/dalli/ring.rb +1 -0
- data/lib/dalli/server.rb +1 -0
- data/lib/dalli/version.rb +1 -1
- metadata +3 -3
data/History.md
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
Dalli Changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
-
|
4
|
+
0.9.6
|
5
|
+
-----
|
6
|
+
|
7
|
+
- Patches for Rails 3.0.1 integration.
|
8
|
+
|
9
|
+
0.9.5
|
5
10
|
-----
|
6
11
|
|
7
12
|
- Major design change - raw support is back to maximize compatibility with Rails
|
8
13
|
and the increment/decrement operations. You can now pass :raw => true to most methods
|
9
14
|
to bypass (un)marshalling.
|
10
15
|
- Support symbols as keys (ddollar)
|
16
|
+
- Rails 2.3 bug fixes
|
11
17
|
|
12
18
|
|
13
19
|
0.9.4
|
@@ -43,4 +49,4 @@ HEAD
|
|
43
49
|
0.9.0
|
44
50
|
-----
|
45
51
|
|
46
|
-
- Initial gem release.
|
52
|
+
- Initial gem release.
|
@@ -64,27 +64,35 @@ module ActiveSupport
|
|
64
64
|
|
65
65
|
# Increment a cached value. This method uses the memcached incr atomic
|
66
66
|
# operator and can only be used on values written with the :raw option.
|
67
|
-
# Calling it on a value not stored with :raw will
|
68
|
-
# to zero.
|
67
|
+
# Calling it on a value not stored with :raw will fail.
|
68
|
+
# :initial defaults to the amount passed in, as if the counter was initially zero.
|
69
|
+
# memcached counters cannot hold negative values.
|
69
70
|
def increment(name, amount = 1, options = nil) # :nodoc:
|
70
71
|
options = merged_options(options)
|
72
|
+
initial = options[:initial] || amount
|
73
|
+
expires_in = options[:expires_in].to_i
|
71
74
|
response = instrument(:increment, name, :amount => amount) do
|
72
|
-
@data.incr(escape_key(namespaced_key(name, options)), amount)
|
75
|
+
@data.incr(escape_key(namespaced_key(name, options)), amount, expires_in, initial)
|
73
76
|
end
|
74
|
-
rescue Dalli::DalliError
|
77
|
+
rescue Dalli::DalliError => e
|
78
|
+
logger.error("DalliError (#{e}): #{e.message}") if logger
|
75
79
|
nil
|
76
80
|
end
|
77
81
|
|
78
82
|
# Decrement a cached value. This method uses the memcached decr atomic
|
79
83
|
# operator and can only be used on values written with the :raw option.
|
80
|
-
# Calling it on a value not stored with :raw will
|
81
|
-
# to zero.
|
84
|
+
# Calling it on a value not stored with :raw will fail.
|
85
|
+
# :initial defaults to zero, as if the counter was initially zero.
|
86
|
+
# memcached counters cannot hold negative values.
|
82
87
|
def decrement(name, amount = 1, options = nil) # :nodoc:
|
83
88
|
options = merged_options(options)
|
89
|
+
initial = options[:initial] || 0
|
90
|
+
expires_in = options[:expires_in].to_i
|
84
91
|
response = instrument(:decrement, name, :amount => amount) do
|
85
|
-
@data.decr(escape_key(namespaced_key(name, options)), amount)
|
92
|
+
@data.decr(escape_key(namespaced_key(name, options)), amount, expires_in, initial)
|
86
93
|
end
|
87
|
-
rescue Dalli::DalliError
|
94
|
+
rescue Dalli::DalliError => e
|
95
|
+
logger.error("DalliError (#{e}): #{e.message}") if logger
|
88
96
|
nil
|
89
97
|
end
|
90
98
|
|
@@ -106,7 +114,7 @@ module ActiveSupport
|
|
106
114
|
protected
|
107
115
|
# Read an entry from the cache.
|
108
116
|
def read_entry(key, options) # :nodoc:
|
109
|
-
deserialize_entry(@data.get(escape_key(key),
|
117
|
+
deserialize_entry(@data.get(escape_key(key), :raw => true))
|
110
118
|
rescue Dalli::DalliError => e
|
111
119
|
logger.error("DalliError (#{e}): #{e.message}") if logger
|
112
120
|
nil
|
data/lib/dalli/ring.rb
CHANGED
data/lib/dalli/server.rb
CHANGED
data/lib/dalli/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
8
|
+
- 6
|
9
|
+
version: 0.9.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mike Perham
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-16 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|