rails-brotli-cache 0.3.9 → 0.3.11

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: 4d2d42ab4cc77a7965e7d04b70b07a672b657d9b4b54be4814f8716595254d8e
4
- data.tar.gz: f81c51e38be663e108538b138fecc80ed726fa701f00e98b658ec028a49528ba
3
+ metadata.gz: 2870c72930bbed4f3ccdc807cf5f62e692bc56456a1c456c123fc4d3b14b537c
4
+ data.tar.gz: c12a04062bdae8ca70535ca15aad9a77953dff01618d544f9bd28408e222cfde
5
5
  SHA512:
6
- metadata.gz: cd18abde6498cd2fd982deb14eac6150c6cddbad7ec418a24fe5bf8dca78458354b5b5419f572311652369ff0f1c20e9d398c7b340195e48028ef6f3ce39a517
7
- data.tar.gz: a5b278df40d8afd4f48e0bf3f1e2c0487b2b3e66e75ecb2c6c937aac483426ea3309081cce6af946e94a88dd984160b5b91ee318129d8b1c92b3a3e41a33d29f
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsBrotliCache
4
- VERSION = "0.3.9"
4
+ VERSION = "0.3.11"
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.9
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb