rails-brotli-cache 0.2.2 → 0.2.3

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: ed8813c2a9849358eb4d1756cd39eda4acf03846ea166880b956d9c630a5f3ee
4
- data.tar.gz: cdff030d0d6bdd7e2b7790c5aea0441ecc89e184165c38e899dc5abdc7f5c900
3
+ metadata.gz: 8f5eae03f927b9f70606cc7b4134fc7173926951da4cf05172bdd9cecb149c61
4
+ data.tar.gz: c89a69ec5b5d5ddbb8efb432d253784ec30be073ca0a4d142edf347cbc4b75cb
5
5
  SHA512:
6
- metadata.gz: 5bf99730b2b31ed9591157fe75764fb15c17cf84cfd664d148a339e8552ed27dc62512cdff39f84552bc151aa4105d8720546eef38aa9e2da0552427d05ab86f
7
- data.tar.gz: 7aa77827f595e73d55dc838ac8c6159a3f0f9138ed5bcdf57b2a0876060e01b66704dfd93f2eb8dc6502d109a0933f825bfc9d422858cbb786b03a75569f32d6
6
+ metadata.gz: 7b8b3daea70b8c8f5cd8f445ee08155eb6356fbab042db3fd505dc26e666fe8a1011080391940d1d77e08d912ddef46d9a7908377bf6135c7784c433a37ce495
7
+ data.tar.gz: 5c37c70c355770b708b7703333a4f941d5b28e51d8a6e140eb256ce5a145fa8da21a86cd72af9498f274c56c97d5b3daa9718e8a58aefe4e206d31f58a8d1471
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # Rails Brotli Cache [![Gem Version](https://badge.fury.io/rb/rails-brotli-cache.svg)](https://badge.fury.io/rb/rails-brotli-cache) [![CircleCI](https://circleci.com/gh/pawurb/rails-brotli-cache.svg?style=svg)](https://circleci.com/gh/pawurb/rails-brotli-cache)
1
+ # Rails Brotli Cache [![Gem Version](https://img.shields.io/gem/v/rails-brotli-cache)](https://badge.fury.io/rb/rails-brotli-cache) [![CircleCI](https://circleci.com/gh/pawurb/rails-brotli-cache.svg?style=svg)](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
- MARK_BR_COMPRESSED + ::Brotli.deflate(serialized, quality: COMPRESS_QUALITY)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsBrotliCache
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  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.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-19 00:00:00.000000000 Z
11
+ date: 2023-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails