rails-brotli-cache 0.3.10 → 0.3.12

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
  SHA256:
3
- metadata.gz: 9c5512004d2aecf612e5d79e2b1718466af061f9e4365f2589d767a8d28bf523
4
- data.tar.gz: 89bffbc70d9cd93e8daf4e65731d4023f82703910b0dc333b3fc07775409ae7b
3
+ metadata.gz: 473f7e06756e422c9c3644f6eb8fbd97fb3c6929d74d5ede901c037c93df7db1
4
+ data.tar.gz: 25ce534d47267870cb70eb49ac849f4dc60073944372b3d26fd81a01dd360834
5
5
  SHA512:
6
- metadata.gz: 329a2f361c842187b6c1afc4585dec17638950503908bd9991f83b4243eb8a798903a10a6537650acb6cf229dd1327b79e8bea5467c2abde07f64e926656c08a
7
- data.tar.gz: fbb555285118d28986c453b2a7c7935ce35a8d06d88d581888f54bff82426e2f8b705a21e42d7b2d63ce18ee20e277c3a08b2e11ff9d1701c41377501faa5088
6
+ metadata.gz: e13c7a3fb0c0591dbb9dd4ccac8bf97aaf9d51ce1ec1d793fd08c678f6d8ba75b65f45f6612a12bbf8a76fc49d7865f591d466753b0d699f474fd33cc8413ab0
7
+ data.tar.gz: 4f0d2fc6e0e2e17e3212a53709fc31831bc62394daad757e1060a323dd46031daaa3ac72be67df254cfd4df8dd71751d31c70567eb217e25ec614dadc29792d3
@@ -58,10 +58,11 @@ module RailsBrotliCache
58
58
  options
59
59
  )
60
60
 
61
- uncompressed(payload)
61
+ uncompressed(payload, options)
62
62
  end
63
63
 
64
64
  def write_multi(hash, options = nil)
65
+ options ||= {}
65
66
  new_hash = hash.map do |key, val|
66
67
  [
67
68
  cache_key(key),
@@ -69,7 +70,10 @@ module RailsBrotliCache
69
70
  ]
70
71
  end
71
72
 
72
- @core_store.write_multi(new_hash, options)
73
+ @core_store.write_multi(
74
+ new_hash,
75
+ options.merge(compress: false)
76
+ )
73
77
  end
74
78
 
75
79
  def read_multi(*names)
@@ -77,7 +81,7 @@ module RailsBrotliCache
77
81
  names = names.map { |name| cache_key(name) }
78
82
 
79
83
  Hash[core_store.read_multi(*names, options).map do |key, val|
80
- [source_cache_key(key), uncompressed(val)]
84
+ [source_cache_key(key), uncompressed(val, options)]
81
85
  end]
82
86
  end
83
87
 
@@ -85,7 +89,9 @@ module RailsBrotliCache
85
89
  options = names.extract_options!
86
90
  names = names.map { |name| cache_key(name) }
87
91
 
88
- @core_store.fetch_multi(*names, options) do |name|
92
+ @core_store.fetch_multi(
93
+ *names, options.merge(compress: false)
94
+ ) do |name|
89
95
  compressed(yield(name), options)
90
96
  end
91
97
  end
@@ -119,8 +125,9 @@ module RailsBrotliCache
119
125
  private
120
126
 
121
127
  def compressed(value, options)
122
- return value if value.is_a?(Integer)
123
128
  options ||= {}
129
+
130
+ return value if value.is_a?(Integer)
124
131
  serialized = Marshal.dump(value)
125
132
 
126
133
  if serialized.bytesize >= COMPRESS_THRESHOLD && !options.fetch(:compress) == false
@@ -136,7 +143,9 @@ module RailsBrotliCache
136
143
  end
137
144
  end
138
145
 
139
- def uncompressed(payload)
146
+ def uncompressed(payload, options)
147
+ options ||= {}
148
+
140
149
  return nil unless payload.present?
141
150
 
142
151
  return payload if payload.is_a?(Integer)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsBrotliCache
4
- VERSION = "0.3.10"
4
+ VERSION = "0.3.12"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-brotli-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb