rails-brotli-cache 0.3.3 → 0.3.4
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 +6 -6
- data/lib/rails-brotli-cache/store.rb +4 -0
- 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: 412dc55dcd3f00210f9c090472b3dfcf10bedba7c2882015a74349797bfe4197
|
4
|
+
data.tar.gz: 7f8085d5fc354f899db174cf6080ea5f03a06f97a714afbb56b9f05aee801a2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 539de77bdcf9cd35b99023859a8e9c8d4cb25c99161ea32699a11818ec45f38165bf29bc7a738fb57e6ee39c8774460b9e2b8a626e77cbf1ed597b3178e6e0c4
|
7
|
+
data.tar.gz: 18326136e7fe619a5af79e6bb3ea803a0656a06aacdf624c7c5f8fd2ef7d175a1a9b24583675b96155e5dd3fc8e838b2dee4bdb3100366c6a799e7462c216c9d
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
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::Store` offers better compression and performance compared to the default `Rails.cache
|
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 performance compared to the default `Rails.cache` Gzip, regardless of the underlying data store. The gem also allows specifying any custom compression algorithm instead of Brotli.
|
4
4
|
|
5
5
|
## Benchmarks
|
6
6
|
|
7
|
-
Brotli cache works as a proxy layer wrapping the
|
7
|
+
Brotli cache works as a proxy layer wrapping the standard cache data store. It applies Brotli compression instead of the default Gzip before storing cache entries.
|
8
8
|
|
9
9
|
```ruby
|
10
10
|
redis_cache = ActiveSupport::Cache::RedisCacheStore.new(
|
@@ -23,8 +23,8 @@ brotli_redis_cache.write("json", json)
|
|
23
23
|
|
24
24
|
## Check the size of cache entries stored in Redis
|
25
25
|
redis = Redis.new(url: "redis://localhost:6379")
|
26
|
-
redis.get("json").size # => 31698
|
27
|
-
redis.get("br-json").size # => 24058
|
26
|
+
redis.get("json").size # => 31698 ~31kb
|
27
|
+
redis.get("br-json").size # => 24058 ~24kb
|
28
28
|
```
|
29
29
|
|
30
30
|
**~20%** better compression of a sample ActiveRecord objects array:
|
@@ -34,8 +34,8 @@ users = User.limit(100).to_a # 100 ActiveRecord objects
|
|
34
34
|
redis_cache.write("users", users)
|
35
35
|
brotli_redis_cache.write("users", users)
|
36
36
|
|
37
|
-
redis.get("users").size # => 12331
|
38
|
-
redis.get("br-users").size # => 10299
|
37
|
+
redis.get("users").size # => 12331 ~12kb
|
38
|
+
redis.get("br-users").size # => 10299 ~10kb
|
39
39
|
```
|
40
40
|
|
41
41
|
**~25%** faster performance for reading/writing a larger JSON file:
|
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.3.
|
4
|
+
version: 0.3.4
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|