rails-brotli-cache 0.2.2 → 0.2.3
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/README.md +4 -4
- data/lib/rails-brotli-cache/store.rb +6 -1
- data/lib/rails-brotli-cache/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f5eae03f927b9f70606cc7b4134fc7173926951da4cf05172bdd9cecb149c61
|
4
|
+
data.tar.gz: c89a69ec5b5d5ddbb8efb432d253784ec30be073ca0a4d142edf347cbc4b75cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b8b3daea70b8c8f5cd8f445ee08155eb6356fbab042db3fd505dc26e666fe8a1011080391940d1d77e08d912ddef46d9a7908377bf6135c7784c433a37ce495
|
7
|
+
data.tar.gz: 5c37c70c355770b708b7703333a4f941d5b28e51d8a6e140eb256ce5a145fa8da21a86cd72af9498f274c56c97d5b3daa9718e8a58aefe4e206d31f58a8d1471
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
# Rails Brotli Cache [](https://badge.fury.io/rb/rails-brotli-cache) [](https://circleci.com/gh/pawurb/rails-brotli-cache)
|
2
2
|
|
3
|
-
This gem enables support for compressing Ruby on Rails cache entries using the [Brotli compression algorithm](https://github.com/google/brotli). `RailsBrotliCache` offers better compression and faster performance compared to the default `Rails.cache` regardless of the underlying data store.
|
4
|
-
|
5
|
-
**The gem is currently in an early stage of development. Ideas on how to improve it and PRs are welcome.**
|
3
|
+
This gem enables support for compressing Ruby on Rails cache entries using the [Brotli compression algorithm](https://github.com/google/brotli). `RailsBrotliCache::Store` offers better compression and faster performance compared to the default `Rails.cache` regardless of the underlying data store.
|
6
4
|
|
7
5
|
## Benchmarks
|
8
6
|
|
@@ -110,6 +108,8 @@ config.cache_store = RailsBrotliCache::Store.new(
|
|
110
108
|
)
|
111
109
|
```
|
112
110
|
|
111
|
+
Addition of the prefix means that you can safely add the Brotli the cache config and avoid compression algorithm conflicts between old and new entries. After configuring the Brotli cache you should run `Rails.cache.clear` to remove the outdated (gzipped) entries.
|
112
|
+
|
113
113
|
## Testing
|
114
114
|
|
115
115
|
```bash
|
@@ -43,7 +43,12 @@ module RailsBrotliCache
|
|
43
43
|
serialized = Marshal.dump(value)
|
44
44
|
|
45
45
|
payload = if serialized.bytesize >= COMPRESS_THRESHOLD
|
46
|
-
|
46
|
+
compressed_payload = ::Brotli.deflate(serialized, quality: COMPRESS_QUALITY)
|
47
|
+
if compressed_payload.bytesize < serialized.bytesize
|
48
|
+
MARK_BR_COMPRESSED + compressed_payload
|
49
|
+
else
|
50
|
+
serialized
|
51
|
+
end
|
47
52
|
else
|
48
53
|
serialized
|
49
54
|
end
|
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.3
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|