rails-brotli-cache 0.3.8 → 0.3.10

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: 3bb8214df1fb2d155f5ae121938b65e447206dba8480066ce6fe0ae3224a18f5
4
- data.tar.gz: 9831643f175b1e5b7d8904ca696302640bd7fc5f3216f93575795ee4192d1fd1
3
+ metadata.gz: 9c5512004d2aecf612e5d79e2b1718466af061f9e4365f2589d767a8d28bf523
4
+ data.tar.gz: 89bffbc70d9cd93e8daf4e65731d4023f82703910b0dc333b3fc07775409ae7b
5
5
  SHA512:
6
- metadata.gz: 0c8297ac281da41e9923721bc24984aa5f795eede3748ee93aa4a47c2d614dfbfe5641255217b010d126852723c69858f27b58f985125fd1b024472641ac46ff
7
- data.tar.gz: 7ad44d4c2c4f1a9411d13fa44d11cbea56b262328e1a62b72f6b14ad8d397f6a53cc09542d5b918d80b504bcd4df6f27c08cec8ae4467a26ab494f1644ab1159
6
+ metadata.gz: 329a2f361c842187b6c1afc4585dec17638950503908bd9991f83b4243eb8a798903a10a6537650acb6cf229dd1327b79e8bea5467c2abde07f64e926656c08a
7
+ data.tar.gz: fbb555285118d28986c453b2a7c7935ce35a8d06d88d581888f54bff82426e2f8b705a21e42d7b2d63ce18ee20e277c3a08b2e11ff9d1701c41377501faa5088
@@ -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
 
@@ -126,6 +119,7 @@ module RailsBrotliCache
126
119
  private
127
120
 
128
121
  def compressed(value, options)
122
+ return value if value.is_a?(Integer)
129
123
  options ||= {}
130
124
  serialized = Marshal.dump(value)
131
125
 
@@ -171,7 +165,7 @@ module RailsBrotliCache
171
165
  end
172
166
 
173
167
  def source_cache_key(name)
174
- name.remove(@prefix)
168
+ name.delete_prefix(@prefix.to_s)
175
169
  end
176
170
 
177
171
  class BrotliCompressor
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsBrotliCache
4
- VERSION = "0.3.8"
4
+ VERSION = "0.3.10"
5
5
  end
@@ -62,38 +62,38 @@ describe RailsBrotliCache do
62
62
  end
63
63
 
64
64
  it "for #write_multi and #read_multi" do
65
- values = {
66
- "key_1" => "val_1",
67
- "key_2" => "val_2"
68
- }
65
+ values = {
66
+ "key_1" => "val_1",
67
+ "key_2" => "val_2"
68
+ }
69
69
 
70
- brotli_store.write_multi(values)
71
- standard_cache.write_multi(values)
70
+ brotli_store.write_multi(values)
71
+ standard_cache.write_multi(values)
72
72
 
73
- expect(brotli_store.read("key_1")).to eq standard_cache.read("key_1")
74
- expect(brotli_store.read("key_2")).to eq standard_cache.read("key_2")
73
+ expect(brotli_store.read("key_1")).to eq standard_cache.read("key_1")
74
+ expect(brotli_store.read("key_2")).to eq standard_cache.read("key_2")
75
75
 
76
- expect(brotli_store.read_multi("key_1", "key_2")).to eq(standard_cache.read_multi("key_1", "key_2"))
76
+ expect(brotli_store.read_multi("key_1", "key_2")).to eq(standard_cache.read_multi("key_1", "key_2"))
77
77
  end
78
78
 
79
79
  it "for #fetch_multi" do
80
- values = {
81
- "key_1" => "val_1",
82
- "key_2" => "val_2"
83
- }
80
+ values = {
81
+ "key_1" => "val_1",
82
+ "key_2" => "val_2"
83
+ }
84
84
 
85
- brotli_store.fetch_multi("key_1", "key_2") do |key|
86
- "val_#{key.split('_').last}"
87
- end
85
+ brotli_store.fetch_multi("key_1", "key_2") do |key|
86
+ "val_#{key.split('_').last}"
87
+ end
88
88
 
89
- standard_cache.fetch_multi("key_1", "key_2") do |key|
90
- "val_#{key.split('_').last}"
91
- end
89
+ standard_cache.fetch_multi("key_1", "key_2") do |key|
90
+ "val_#{key.split('_').last}"
91
+ end
92
92
 
93
- expect(brotli_store.read("key_1")).to eq standard_cache.read("key_1")
94
- expect(brotli_store.read("key_2")).to eq standard_cache.read("key_2")
93
+ expect(brotli_store.read("key_1")).to eq standard_cache.read("key_1")
94
+ expect(brotli_store.read("key_2")).to eq standard_cache.read("key_2")
95
95
 
96
- expect(brotli_store.read_multi("key_1", "key_2")).to eq(standard_cache.read_multi("key_1", "key_2"))
96
+ expect(brotli_store.read_multi("key_1", "key_2")).to eq(standard_cache.read_multi("key_1", "key_2"))
97
97
  end
98
98
  end
99
99
  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.8
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawurb