dalli 5.0.13 → 5.0.14
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/dalli/protocol/meta.rb +12 -2
- data/lib/dalli/protocol/request_formatter.rb +19 -1
- data/lib/dalli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b52725fdd6dd9e4e890f506cca29a520e12e5458b29d9e315b6bb8805d749c7
|
|
4
|
+
data.tar.gz: 504b5d320f3802d5aeb98608ffbc1ff629a89c76ba48957440b3403b40a5a69e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d258b16c57f90309b60867fac9e1aa03fd9ae6a67607d04f2cfd76c205e5f096e8322c532ecf4404d74895dd8a6deca766fac2ca3bb5fff17b646e321e6962f
|
|
7
|
+
data.tar.gz: 430cc33100948d985f373247848122dc79c6ab6cfc1fa295c7fe8fbcc1463cf91e26a17a93d91145ef9c06d57e887aad592d2a437ccc79868886f7b4a40a0cd5
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ Dalli Changelog
|
|
|
4
4
|
Unreleased
|
|
5
5
|
==========
|
|
6
6
|
|
|
7
|
+
5.0.14
|
|
8
|
+
==========
|
|
9
|
+
|
|
10
|
+
Bug fixes:
|
|
11
|
+
|
|
12
|
+
- Raw values in an encoding that isn't ASCII-compatible, such as UTF-16, raised `Encoding::CompatibilityError` from `set`, `add`, `replace`, `append`, `prepend` and `set_multi`, as did a single-server `set_multi` mixing non-ASCII UTF-8 values with binary ones (such as raw Strings of both kinds, or with a JSON serializer, a value containing `é` next to a compressed one). The error also closed the connection, so in a `quiet` block, or within one server's part of a multi-server `set_multi`, writes buffered before it were silently lost. Values are now sent as their bytes, which is what memcached stores (#1269)
|
|
13
|
+
|
|
7
14
|
5.0.13
|
|
8
15
|
==========
|
|
9
16
|
|
data/lib/dalli/protocol/meta.rb
CHANGED
|
@@ -138,7 +138,7 @@ module Dalli
|
|
|
138
138
|
req = RequestFormatter.meta_set(key: key, value: value,
|
|
139
139
|
bitflags: bitflags, cas: cas,
|
|
140
140
|
ttl: ttl, mode: mode, quiet: quiet)
|
|
141
|
-
write(
|
|
141
|
+
write(request_with_value(req, value))
|
|
142
142
|
@connection_manager.flush unless quiet
|
|
143
143
|
end
|
|
144
144
|
# rubocop:enable Metrics/ParameterLists
|
|
@@ -158,10 +158,20 @@ module Dalli
|
|
|
158
158
|
ttl = TtlSanitizer.sanitize(ttl) if ttl
|
|
159
159
|
req = RequestFormatter.meta_set(key: key, value: value,
|
|
160
160
|
cas: cas, ttl: ttl, mode: mode, quiet: quiet?)
|
|
161
|
-
write(
|
|
161
|
+
write(request_with_value(req, value))
|
|
162
162
|
@connection_manager.flush unless quiet?
|
|
163
163
|
end
|
|
164
164
|
|
|
165
|
+
# Ruby refuses to join Strings whose encodings clash, such as a raw
|
|
166
|
+
# UTF-16 value next to the ASCII request line. memcached stores bytes,
|
|
167
|
+
# so join the bytes then. Joining the Strings first keeps the common
|
|
168
|
+
# case free of extra checks.
|
|
169
|
+
def request_with_value(req, value)
|
|
170
|
+
"#{req}#{value}#{TERMINATOR}"
|
|
171
|
+
rescue Encoding::CompatibilityError
|
|
172
|
+
"#{req.b}#{value.b}#{TERMINATOR}"
|
|
173
|
+
end
|
|
174
|
+
|
|
165
175
|
# Delete Commands
|
|
166
176
|
def delete(key, cas)
|
|
167
177
|
req = RequestFormatter.meta_delete(key: key, cas: cas, quiet: quiet?)
|
|
@@ -95,11 +95,29 @@ module Dalli
|
|
|
95
95
|
buffer << ' b' if base64
|
|
96
96
|
buffer << " F#{bitflags}" if bitflags
|
|
97
97
|
buffer << " T#{ttl}" if ttl
|
|
98
|
-
buffer << ' MS q' << TERMINATOR
|
|
98
|
+
buffer << ' MS q' << TERMINATOR
|
|
99
|
+
append_bytes(buffer, value)
|
|
100
|
+
buffer << TERMINATOR
|
|
99
101
|
end
|
|
100
102
|
buffer << META_NOOP
|
|
101
103
|
end
|
|
102
104
|
|
|
105
|
+
# Values are appended as bytes. One batch can hold UTF-8 and binary
|
|
106
|
+
# values, which String#<< refuses to combine, and a raw value can be in
|
|
107
|
+
# an encoding that isn't ASCII-compatible, such as UTF-16.
|
|
108
|
+
# Don't chain on the result: TruffleRuby's append_as_bytes returns its
|
|
109
|
+
# arguments rather than the buffer.
|
|
110
|
+
if String.method_defined?(:append_as_bytes)
|
|
111
|
+
def append_bytes(buffer, value)
|
|
112
|
+
buffer.append_as_bytes(value)
|
|
113
|
+
end
|
|
114
|
+
else
|
|
115
|
+
def append_bytes(buffer, value)
|
|
116
|
+
buffer << (value.encoding == Encoding::BINARY ? value : value.b)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
private :append_bytes
|
|
120
|
+
|
|
103
121
|
# Thundering herd protection flag:
|
|
104
122
|
# - stale (I flag): Instead of deleting the item, mark it as stale. Other clients
|
|
105
123
|
# using N/R flags will see the X flag and know the item is being regenerated.
|
data/lib/dalli/version.rb
CHANGED