rails-brotli-cache 0.3.2 → 0.3.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: c53c91a3df8a561eadcb309bc1a0a3315ca331ec36fe9bfe0995b21dc09c821b
4
- data.tar.gz: d74f60c63d75643f57ac1c3568b436ed817dcb69e73cd19d4ab369c420deeba2
3
+ metadata.gz: 93b71dde73a988ed1a008810be38e9b30311896e41cf3c6017feebbfce4fec32
4
+ data.tar.gz: c3c9b8da01d4e3bcadd33fca01a3648b591db18dc807536190f43f34a4af2159
5
5
  SHA512:
6
- metadata.gz: f2f4b9f01712a860dd57b6da48cb284c68a92593a50955796abf8eafd8b32e5b712233d0e7029aa3c26ed65b098547e25a3311b83cf6c94f8c6f74b2cdcaf443
7
- data.tar.gz: c858ee0fd911aa7805ed2b74ab9dc15328b3584918b5da262b60df3a8a27f9982412b00001ba9da4f189038c57e9b0e2620116dba60b4982b91b5da8f7ad8ae4
6
+ metadata.gz: 33648f7e5a975d4c87ea10356e2ea5dc5220ade8d6a188ba3891a5387b47506079d4f4c7763f61458663868835e16f721489cd16132cd6ca671807531f14f0cc
7
+ data.tar.gz: 27d9f9b5c42134eccd351807bfd44f4d6fcc19baae2ef13a466f013c95406971feab785bced3c82827a709342f4a0672b7dee0e012f2f7c2003fac267daf7d43
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
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::Store` offers better compression and faster performance compared to the default `Rails.cache`, regardless of the underlying data store. The gem also allows specifying any custom compression algorithm instead of Brotli.
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`, 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
 
@@ -103,7 +103,7 @@ config.cache_store = RailsBrotliCache::Store.new(
103
103
  )
104
104
  ```
105
105
 
106
- You should avoid using it with `ActiveSupport::Cache::MemoryStore`. This type of cache store does not serialize or compress objects but keeps them directly in the RAM of a Ruby process. In this case, adding this gem would reduce RAM usage but add huge performance overhead.
106
+ You should avoid using it with `ActiveSupport::Cache::MemoryStore`. This type of cache store does not serialize or compress objects but keeps them directly in the RAM. In this case, adding this gem would reduce RAM usage but add huge performance overhead.
107
107
 
108
108
  Gem appends `br-` to the cache key names to prevent conflicts with previously saved entries. You can disable this behavior by passing `{ prefix: nil }` during initialization:
109
109
 
@@ -82,6 +82,10 @@ module RailsBrotliCache
82
82
  Marshal.load(serialized)
83
83
  end
84
84
 
85
+ def exist?(name, options = nil)
86
+ @core_store.exist?(cache_key(name), options)
87
+ end
88
+
85
89
  def delete(name, options = nil)
86
90
  @core_store.delete(cache_key(name), options)
87
91
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsBrotliCache
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
@@ -40,6 +40,17 @@ describe RailsBrotliCache do
40
40
  end
41
41
  end
42
42
 
43
+ describe "exist?" do
44
+ it "returns true if cache entry exists" do
45
+ cache_store.write("test-key", 1234)
46
+ expect(cache_store.exist?("test-key")).to eq true
47
+ end
48
+
49
+ it "returns false if cache entry does not exist" do
50
+ expect(cache_store.exist?("test-key")).to eq false
51
+ end
52
+ end
53
+
43
54
  describe "#core_store" do
44
55
  it "exposes the underlying data store" do
45
56
  expect(cache_store.core_store.class).to eq ActiveSupport::Cache::MemoryStore
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.2
4
+ version: 0.3.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-21 00:00:00.000000000 Z
11
+ date: 2023-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails