rails-brotli-cache 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/benchmarks/Gemfile +2 -0
- data/lib/rails-brotli-cache/store.rb +3 -2
- data/lib/rails-brotli-cache/version.rb +1 -1
- data/rails-brotli-cache.gemspec +2 -2
- data/spec/rails-brotli-cache/redis_spec.rb +6 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f25f2d703bace978a6a84e686d55a80aa926366d0795d032dc4bbab325b863af
|
4
|
+
data.tar.gz: 027b2040bbe634ccc19e234bbbf550262add716e3f3ecdc2a5b1c82f947847c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b84b6bc932bed9537116349df16b39524fc4e93b7b9e54e49e254de080e7a0513fa4a0a58722cc5a1e4a455d0c5c7d9226cf9192731a5617f4bf772eb210c5aa
|
7
|
+
data.tar.gz: bafd5345b64fb78db2815036eccbae16edd8fcbc7dc91b4acc8c1009e114be5c25e80b05e5498de1d500e3a10b138c8b086760127ba6462accaef33777fc57c8
|
data/README.md
CHANGED
data/benchmarks/Gemfile
CHANGED
@@ -41,8 +41,9 @@ module RailsBrotliCache
|
|
41
41
|
|
42
42
|
def write(name, value, options = nil)
|
43
43
|
serialized = Marshal.dump(value)
|
44
|
+
options = (options || {}).reverse_merge(compress: true)
|
44
45
|
|
45
|
-
payload = if serialized.bytesize >= COMPRESS_THRESHOLD
|
46
|
+
payload = if serialized.bytesize >= COMPRESS_THRESHOLD && !options.fetch(:compress) == false
|
46
47
|
compressed_payload = ::Brotli.deflate(serialized, quality: COMPRESS_QUALITY)
|
47
48
|
if compressed_payload.bytesize < serialized.bytesize
|
48
49
|
MARK_BR_COMPRESSED + compressed_payload
|
@@ -56,7 +57,7 @@ module RailsBrotliCache
|
|
56
57
|
@core_store.write(
|
57
58
|
cache_key(name),
|
58
59
|
payload,
|
59
|
-
|
60
|
+
options.merge(compress: false)
|
60
61
|
)
|
61
62
|
end
|
62
63
|
|
data/rails-brotli-cache.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = RailsBrotliCache::VERSION
|
9
9
|
gem.authors = ["pawurb"]
|
10
10
|
gem.email = ["contact@pawelurbanek.com"]
|
11
|
-
gem.summary = %q{
|
12
|
-
gem.description = %q{
|
11
|
+
gem.summary = %q{ Drop-in enhancement for Rails cache, offering better performance and compression with Brotli algorithm. }
|
12
|
+
gem.description = %q{ This gem reduces storage needed for Rails cache by using Brotli compression, which can produce outputs smaller by ~20% and offers better performance than Gzip. }
|
13
13
|
gem.homepage = "https://github.com/pawurb/rails-brotli-cache"
|
14
14
|
gem.files = `git ls-files`.split("\n")
|
15
15
|
gem.test_files = gem.files.grep(%r{^(spec)/})
|
@@ -33,6 +33,12 @@ describe RailsBrotliCache do
|
|
33
33
|
expect($redis.get("gz-test-key").size > $redis.get("br-test-key").size).to eq true
|
34
34
|
end
|
35
35
|
|
36
|
+
it "respects { compress: false } setting and does not apply compression" do
|
37
|
+
Rails.cache.write("gz-test-key", json)
|
38
|
+
cache_store.write("test-key", json, compress: false)
|
39
|
+
expect($redis.get("gz-test-key").size < $redis.get("br-test-key").size).to eq true
|
40
|
+
end
|
41
|
+
|
36
42
|
describe "disable_prefix" do
|
37
43
|
context "default prefix" do
|
38
44
|
it "appends 'br-' prefix" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-brotli-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -94,8 +94,8 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description: "
|
98
|
-
|
97
|
+
description: " This gem reduces storage needed for Rails cache by using Brotli compression,
|
98
|
+
which can produce outputs smaller by ~20% and offers better performance than Gzip. "
|
99
99
|
email:
|
100
100
|
- contact@pawelurbanek.com
|
101
101
|
executables: []
|
@@ -184,7 +184,8 @@ requirements: []
|
|
184
184
|
rubygems_version: 3.1.6
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
|
-
summary:
|
187
|
+
summary: Drop-in enhancement for Rails cache, offering better performance and compression
|
188
|
+
with Brotli algorithm.
|
188
189
|
test_files:
|
189
190
|
- spec/dummy/Gemfile
|
190
191
|
- spec/dummy/README.md
|