cacheflow 0.4.0 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 175592979961554546a3074ac8f8a411f26e81e695a24418a764e5806736f180
4
- data.tar.gz: f0c60bd1b5b507872116a7867cf2efa38989ca74c1cc23df5db30e0e7b5f0bbd
3
+ metadata.gz: 83e311f4b1bb6c8bd7a57b7163409bee62be374072bf51ec1177751d1d6e1469
4
+ data.tar.gz: 4df0794c70e520f454d6fa7a0f1369fce78abed94e664dc86513005e60c2a159
5
5
  SHA512:
6
- metadata.gz: c2f9c3d04f22043652211e50537fe2586d0c61a548f28e6be398067185bc7b07e4dfbad88f134d7b795e95bc4a2ade4727e4143be2740f11895baf0fe41d6c5d
7
- data.tar.gz: dd4e4f821650260facf20402756af047027689cbea55e9f2014c697a56f76abfc1d1a8cd1841d0ff7388a34ace681d1e1b7a815bfb00ec33ac105afa2042be14
6
+ metadata.gz: 06cb724109dcf6061f6a3635564e8438bfe0100545232d19e99a8980a9325ffe1ee8d1d9d541a70414131c376989c984802fcd80736cf43063e13da943c1ef64
7
+ data.tar.gz: 9da38e3824cccee4a0cb45534d7f2ef94609e8ed4bc4ce59eb81518101688286c11d355d489f4891334d5a582d84e121415f3400476b6d4ae0809b0cda6d9278
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.6.0 (2026-04-01)
2
+
3
+ - Added support for Dalli 5
4
+ - Fixed `silence_sidekiq!` method for Sidekiq 7+
5
+ - Dropped support for `redis` < 5
6
+ - Dropped support for Ruby < 3.3 and Active Support < 7.2
7
+
8
+ ## 0.5.0 (2025-05-05)
9
+
10
+ - Dropped support for Ruby < 3.2 and Active Support < 7.1
11
+
1
12
  ## 0.4.0 (2024-10-22)
2
13
 
3
14
  - Improved binary data detection
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017-2024 Andrew Kane
1
+ Copyright (c) 2017-2026 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Cacheflow
2
2
 
3
- Colorized logging for Memcached and Redis
3
+ Colorized logging for Memcached, Redis, and Valkey
4
4
 
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
5
+ Works with the Rails cache, as well as [Dalli](https://github.com/petergoldstein/dalli), [Redis](https://github.com/redis/redis-rb), and [RedisClient](https://github.com/redis-rb/redis-client) clients directly
6
6
 
7
7
  [![Build Status](https://github.com/ankane/cacheflow/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/cacheflow/actions)
8
8
 
@@ -14,7 +14,7 @@ Add this line to your application’s Gemfile:
14
14
  gem "cacheflow", group: :development
15
15
  ```
16
16
 
17
- When your log level is set to `DEBUG` (Rails default in development), all commands to Memcached and Redis are logged.
17
+ When your log level is set to `DEBUG` (Rails default in development), all commands to Memcached, Redis, and Valkey are logged.
18
18
 
19
19
  ## Features
20
20
 
@@ -26,7 +26,7 @@ Cacheflow.silence do
26
26
  end
27
27
  ```
28
28
 
29
- To silence logging for [Sidekiq](https://github.com/mperham/sidekiq) commands, create an initializer with:
29
+ To silence logging for [Sidekiq](https://github.com/sidekiq/sidekiq) commands, create an initializer with:
30
30
 
31
31
  ```ruby
32
32
  Cacheflow.silence_sidekiq!
@@ -34,7 +34,7 @@ Cacheflow.silence_sidekiq!
34
34
 
35
35
  ## Data Protection
36
36
 
37
- If you use Cacheflow in an environment with [personal data](https://en.wikipedia.org/wiki/Personally_identifiable_information) and store that data in Memcached or Redis, it can end up in your app logs. To avoid this, silence logging for those calls.
37
+ If you use Cacheflow in an environment with [personal data](https://en.wikipedia.org/wiki/Personal_data) and store that data in Memcached, Redis, or Valkey, it can end up in your app logs. To avoid this, silence logging for those calls.
38
38
 
39
39
  ## History
40
40
 
@@ -23,9 +23,12 @@ module Cacheflow
23
23
  end
24
24
  end
25
25
 
26
+ if defined?(Dalli::Protocol::Meta)
27
+ Dalli::Protocol::Meta.prepend(Cacheflow::Memcached::Notifications)
28
+ end
29
+
26
30
  if defined?(Dalli::Protocol::Binary)
27
31
  Dalli::Protocol::Binary.prepend(Cacheflow::Memcached::Notifications)
28
- else
29
- Dalli::Server.prepend(Cacheflow::Memcached::Notifications)
30
32
  end
33
+
31
34
  Cacheflow::Memcached::Instrumenter.attach_to(:memcached)
@@ -1,6 +1,5 @@
1
1
  module Cacheflow
2
2
  module Redis
3
- # redis 5 / redis-client
4
3
  module ClientNotifications
5
4
  def call(command, redis_config)
6
5
  payload = {
@@ -21,18 +20,6 @@ module Cacheflow
21
20
  end
22
21
  end
23
22
 
24
- # redis 4
25
- module Notifications
26
- def logging(commands)
27
- payload = {
28
- commands: commands
29
- }
30
- ActiveSupport::Notifications.instrument("query.redis", payload) do
31
- super
32
- end
33
- end
34
- end
35
-
36
23
  class Instrumenter < ActiveSupport::LogSubscriber
37
24
  def query(event)
38
25
  return if !logger.debug? || Cacheflow.silenced?
@@ -50,11 +37,5 @@ module Cacheflow
50
37
  end
51
38
  end
52
39
 
53
- if defined?(RedisClient)
54
- RedisClient.register(Cacheflow::Redis::ClientNotifications)
55
- elsif defined?(Redis)
56
- # redis < 5
57
- Redis::Client.prepend(Cacheflow::Redis::Notifications)
58
- end
59
-
40
+ RedisClient.register(Cacheflow::Redis::ClientNotifications)
60
41
  Cacheflow::Redis::Instrumenter.attach_to(:redis)
@@ -1,7 +1,7 @@
1
1
  module Cacheflow
2
2
  module Sidekiq
3
- module ClassMethods
4
- def redis(*_)
3
+ module InstanceMethods
4
+ def redis(...)
5
5
  Cacheflow.silence do
6
6
  super
7
7
  end
@@ -10,7 +10,7 @@ module Cacheflow
10
10
 
11
11
  module Client
12
12
  module InstanceMethods
13
- def push(*_)
13
+ def push(...)
14
14
  Cacheflow.silence do
15
15
  super
16
16
  end
@@ -20,5 +20,9 @@ module Cacheflow
20
20
  end
21
21
  end
22
22
 
23
- ::Sidekiq.singleton_class.prepend(Cacheflow::Sidekiq::ClassMethods)
23
+ if defined?(::Sidekiq::Capsule)
24
+ ::Sidekiq::Capsule.prepend(Cacheflow::Sidekiq::InstanceMethods)
25
+ end
26
+
27
+ ::Sidekiq::Config.prepend(Cacheflow::Sidekiq::InstanceMethods)
24
28
  ::Sidekiq::Client.prepend(Cacheflow::Sidekiq::Client::InstanceMethods)
@@ -1,3 +1,3 @@
1
1
  module Cacheflow
2
- VERSION = "0.4.0"
2
+ VERSION = "0.6.0"
3
3
  end
data/lib/cacheflow.rb CHANGED
@@ -7,7 +7,7 @@ require_relative "cacheflow/version"
7
7
  module Cacheflow
8
8
  def self.activate
9
9
  require_relative "cacheflow/memcached" if defined?(Dalli)
10
- require_relative "cacheflow/redis" if defined?(Redis) || defined?(RedisClient)
10
+ require_relative "cacheflow/redis" if defined?(RedisClient)
11
11
  end
12
12
 
13
13
  def self.silenced?
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cacheflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-23 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -16,15 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '7'
18
+ version: '7.2'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '7'
27
- description:
25
+ version: '7.2'
28
26
  email: andrew@ankane.org
29
27
  executables: []
30
28
  extensions: []
@@ -43,7 +41,6 @@ homepage: https://github.com/ankane/cacheflow
43
41
  licenses:
44
42
  - MIT
45
43
  metadata: {}
46
- post_install_message:
47
44
  rdoc_options: []
48
45
  require_paths:
49
46
  - lib
@@ -51,15 +48,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
48
  requirements:
52
49
  - - ">="
53
50
  - !ruby/object:Gem::Version
54
- version: '3.1'
51
+ version: '3.3'
55
52
  required_rubygems_version: !ruby/object:Gem::Requirement
56
53
  requirements:
57
54
  - - ">="
58
55
  - !ruby/object:Gem::Version
59
56
  version: '0'
60
57
  requirements: []
61
- rubygems_version: 3.5.16
62
- signing_key:
58
+ rubygems_version: 4.0.6
63
59
  specification_version: 4
64
- summary: Colorized logging for Memcached and Redis
60
+ summary: Colorized logging for Memcached, Redis, and Valkey
65
61
  test_files: []