cacheflow 0.2.1 → 0.3.0

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: 6080f46e40efef7ff1bea205ff685aecd6057996c3b8dc98601883b22a323791
4
- data.tar.gz: b78f678270ea70bdf0f55de264337302c39ecce2e9c62835bdd02aa8ab7b33d8
3
+ metadata.gz: dc96e1e878dacf8275f2113b546cfab2d64baa98df3187c6b828c6f5397e9d6a
4
+ data.tar.gz: 181f8cd6e5c6c0f1abd5a349d5ebef1892c31e609148577c6a262b1c4ba2c9f7
5
5
  SHA512:
6
- metadata.gz: 1bb9f8cb1232710849b248a52abe2d85a223bfd49c8bf90b5d325102b1ea35e71363c52598d727e0cd2fa6ca9a6952127ce059aba59262cc1295dea3f585863e
7
- data.tar.gz: 79febce9eafa8f777f4ca4c86a166be1e17c5cef655250d4fd12bfe3ccbcbae2d9f18bddf30ac15b50296a621796f80a10709b79b28bde4837f2188b8e6a1bee
6
+ metadata.gz: f174f62627d4c487ca492cf416cefa2369f713bfaefcac323ab6d0db8eae60aa29730af6d999db188f7a41c8413a4162fe6f4ed5a63aa773d72e9bfa1c1c17be
7
+ data.tar.gz: 1a58a047b78cc91760e7336bd3b014d716d01c7ccc8312ef5c8a045fdeaf5ebb1647a7b97b7e8136475a624215c4ba5e5dca8e13fba13333517d878203ab25df
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.3.0 (2022-09-05)
2
+
3
+ - Added support for `redis` 5 and `redis-client` gems
4
+ - Dropped support for Ruby < 2.7 and Active Support < 6
5
+
1
6
  ## 0.2.1 (2022-01-12)
2
7
 
3
8
  - Fixed deprecation warning with Dalli 3
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Colorized logging for Memcached and Redis
4
4
 
5
- ![Screenshot](https://gist.githubusercontent.com/ankane/64d630db934c5222587794232a690864/raw/880b70fdbd2d11ccc8475f4616397184918852e8/console.png)
6
-
7
5
  Works with the Rails cache, as well as [Dalli](https://github.com/petergoldstein/dalli) and [Redis](https://github.com/redis/redis-rb) clients directly
8
6
 
9
7
  [![Build Status](https://github.com/ankane/cacheflow/workflows/build/badge.svg?branch=master)](https://github.com/ankane/cacheflow/actions)
@@ -1,5 +1,27 @@
1
1
  module Cacheflow
2
2
  module Redis
3
+ # redis 5 / redis-client
4
+ module ClientNotifications
5
+ def call(command, redis_config)
6
+ payload = {
7
+ commands: [command]
8
+ }
9
+ ActiveSupport::Notifications.instrument("query.redis", payload) do
10
+ super
11
+ end
12
+ end
13
+
14
+ def call_pipelined(commands, redis_config)
15
+ payload = {
16
+ commands: commands
17
+ }
18
+ ActiveSupport::Notifications.instrument("query.redis", payload) do
19
+ super
20
+ end
21
+ end
22
+ end
23
+
24
+ # redis 4
3
25
  module Notifications
4
26
  def logging(commands)
5
27
  payload = {
@@ -28,5 +50,12 @@ module Cacheflow
28
50
  end
29
51
  end
30
52
 
31
- Redis::Client.prepend(Cacheflow::Redis::Notifications)
53
+ if defined?(RedisClient)
54
+ RedisClient.register(Cacheflow::Redis::ClientNotifications)
55
+ end
56
+
57
+ if Redis::VERSION.to_i < 5
58
+ Redis::Client.prepend(Cacheflow::Redis::Notifications)
59
+ end
60
+
32
61
  Cacheflow::Redis::Instrumenter.attach_to(:redis)
@@ -1,3 +1,3 @@
1
1
  module Cacheflow
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/cacheflow.rb CHANGED
@@ -7,7 +7,7 @@ require "cacheflow/version"
7
7
  module Cacheflow
8
8
  def self.activate
9
9
  require "cacheflow/memcached" if defined?(Dalli)
10
- require "cacheflow/redis" if defined?(Redis)
10
+ require "cacheflow/redis" if defined?(Redis) || defined?(RedisClient)
11
11
  end
12
12
 
13
13
  def self.silenced?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cacheflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-12 00:00:00.000000000 Z
11
+ date: 2022-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5.2'
26
+ version: '6'
27
27
  description:
28
28
  email: andrew@ankane.org
29
29
  executables: []
@@ -50,14 +50,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: '2.6'
53
+ version: '2.7'
54
54
  required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - ">="
57
57
  - !ruby/object:Gem::Version
58
58
  version: '0'
59
59
  requirements: []
60
- rubygems_version: 3.3.3
60
+ rubygems_version: 3.3.7
61
61
  signing_key:
62
62
  specification_version: 4
63
63
  summary: Colorized logging for Memcached and Redis