rails-brotli-cache 0.3.9 → 0.3.11
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/lib/rails-brotli-cache/store.rb +7 -10
- data/lib/rails-brotli-cache/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: 2870c72930bbed4f3ccdc807cf5f62e692bc56456a1c456c123fc4d3b14b537c
|
4
|
+
data.tar.gz: c12a04062bdae8ca70535ca15aad9a77953dff01618d544f9bd28408e222cfde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5683b7363fc845e04739e077315fc0d0e363d8dda8fc6dcc9d3f44eb2d0ec5e8a4dc4d45ef8e6d1354f7ba669c9befae4cd30dda3f1da553eec1ed73d4e41076
|
7
|
+
data.tar.gz: 636786c88da156a5938cb8a637deebb916c354b0e0171ae0389085dae69dce5dbe10a627468432f217aaa3aba74fbdc03f957284607ab658713f2c6bbfa320fe
|
@@ -42,13 +42,6 @@ module RailsBrotliCache
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def write(name, value, options = nil)
|
45
|
-
if value.is_a?(Integer)
|
46
|
-
return @core_store.write(
|
47
|
-
cache_key(name),
|
48
|
-
value
|
49
|
-
)
|
50
|
-
end
|
51
|
-
|
52
45
|
options = (options || {}).reverse_merge(compress: true)
|
53
46
|
payload = compressed(value, options)
|
54
47
|
|
@@ -65,7 +58,7 @@ module RailsBrotliCache
|
|
65
58
|
options
|
66
59
|
)
|
67
60
|
|
68
|
-
uncompressed(payload)
|
61
|
+
uncompressed(payload, options)
|
69
62
|
end
|
70
63
|
|
71
64
|
def write_multi(hash, options = nil)
|
@@ -84,7 +77,7 @@ module RailsBrotliCache
|
|
84
77
|
names = names.map { |name| cache_key(name) }
|
85
78
|
|
86
79
|
Hash[core_store.read_multi(*names, options).map do |key, val|
|
87
|
-
[source_cache_key(key), uncompressed(val)]
|
80
|
+
[source_cache_key(key), uncompressed(val, options)]
|
88
81
|
end]
|
89
82
|
end
|
90
83
|
|
@@ -127,6 +120,8 @@ module RailsBrotliCache
|
|
127
120
|
|
128
121
|
def compressed(value, options)
|
129
122
|
options ||= {}
|
123
|
+
|
124
|
+
return value if value.is_a?(Integer)
|
130
125
|
serialized = Marshal.dump(value)
|
131
126
|
|
132
127
|
if serialized.bytesize >= COMPRESS_THRESHOLD && !options.fetch(:compress) == false
|
@@ -142,7 +137,9 @@ module RailsBrotliCache
|
|
142
137
|
end
|
143
138
|
end
|
144
139
|
|
145
|
-
def uncompressed(payload)
|
140
|
+
def uncompressed(payload, options)
|
141
|
+
options ||= {}
|
142
|
+
|
146
143
|
return nil unless payload.present?
|
147
144
|
|
148
145
|
return payload if payload.is_a?(Integer)
|