cacheflow 0.1.1 → 0.3.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
- SHA1:
3
- metadata.gz: ac0a2640873e62e3bbb8770586da459cc7de3657
4
- data.tar.gz: 5359925b29dd20b4006c44c214ab5313b2114313
2
+ SHA256:
3
+ metadata.gz: dc96e1e878dacf8275f2113b546cfab2d64baa98df3187c6b828c6f5397e9d6a
4
+ data.tar.gz: 181f8cd6e5c6c0f1abd5a349d5ebef1892c31e609148577c6a262b1c4ba2c9f7
5
5
  SHA512:
6
- metadata.gz: 6148305fbd5825dd61031e813b080c105076b45ab341b12a7fa908f440d9e4125d457ea2ee4039cd02614dcb99fa8fee967e920c5a34c0192389afb9fe49bfd6
7
- data.tar.gz: c3382fb7dc4f4c125ecc9c1d3e234060103d316540fb968a32e35b9a5d76e36ab84ba181fc509f216feb6ffad92944c4677aece4a9769f4a3fbbf71b9555ce99
6
+ metadata.gz: f174f62627d4c487ca492cf416cefa2369f713bfaefcac323ab6d0db8eae60aa29730af6d999db188f7a41c8413a4162fe6f4ed5a63aa773d72e9bfa1c1c17be
7
+ data.tar.gz: 1a58a047b78cc91760e7336bd3b014d716d01c7ccc8312ef5c8a045fdeaf5ebb1647a7b97b7e8136475a624215c4ba5e5dca8e13fba13333517d878203ab25df
data/CHANGELOG.md CHANGED
@@ -1,8 +1,21 @@
1
- ## 0.1.1
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
+
6
+ ## 0.2.1 (2022-01-12)
7
+
8
+ - Fixed deprecation warning with Dalli 3
9
+
10
+ ## 0.2.0 (2022-01-10)
11
+
12
+ - Dropped support for Ruby < 2.6 and Active Support < 5.2
13
+
14
+ ## 0.1.1 (2017-11-13)
2
15
 
3
16
  - Added `silence` method
4
17
  - Added `silence_sidekiq!` method
5
18
 
6
- ## 0.1.0
19
+ ## 0.1.0 (2017-09-30)
7
20
 
8
21
  - First release
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017 Andrew Kane
1
+ Copyright (c) 2017-2022 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -2,16 +2,16 @@
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
 
7
+ [![Build Status](https://github.com/ankane/cacheflow/workflows/build/badge.svg?branch=master)](https://github.com/ankane/cacheflow/actions)
8
+
9
9
  ## Installation
10
10
 
11
11
  Add this line to your application’s Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'cacheflow', group: :development
14
+ gem "cacheflow", group: :development
15
15
  ```
16
16
 
17
17
  When your log level is set to `DEBUG` (Rails default in development), all commands to Memcached and Redis are logged.
@@ -26,12 +26,16 @@ Cacheflow.silence do
26
26
  end
27
27
  ```
28
28
 
29
- To silence logging for only [Sidekiq](https://github.com/mperham/sidekiq) commands, create an initializer with:
29
+ To silence logging for [Sidekiq](https://github.com/mperham/sidekiq) commands, create an initializer with:
30
30
 
31
31
  ```ruby
32
32
  Cacheflow.silence_sidekiq!
33
33
  ```
34
34
 
35
+ ## Data Protection
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.
38
+
35
39
  ## History
36
40
 
37
41
  View the [changelog](https://github.com/ankane/cacheflow/blob/master/CHANGELOG.md)
@@ -44,3 +48,12 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
44
48
  - Fix bugs and [submit pull requests](https://github.com/ankane/cacheflow/pulls)
45
49
  - Write, clarify, or fix documentation
46
50
  - Suggest or add new features
51
+
52
+ To get started with development:
53
+
54
+ ```sh
55
+ git clone https://github.com/ankane/cacheflow.git
56
+ cd cacheflow
57
+ bundle install
58
+ bundle exec rake test
59
+ ```
@@ -23,5 +23,9 @@ module Cacheflow
23
23
  end
24
24
  end
25
25
 
26
- Dalli::Server.prepend(Cacheflow::Memcached::Notifications)
26
+ if defined?(Dalli::Protocol::Binary)
27
+ Dalli::Protocol::Binary.prepend(Cacheflow::Memcached::Notifications)
28
+ else
29
+ Dalli::Server.prepend(Cacheflow::Memcached::Notifications)
30
+ end
27
31
  Cacheflow::Memcached::Instrumenter.attach_to(:memcached)
@@ -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.1.1"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/cacheflow.rb CHANGED
@@ -1,10 +1,13 @@
1
+ # dependencies
1
2
  require "active_support"
3
+
4
+ # modules
2
5
  require "cacheflow/version"
3
6
 
4
7
  module Cacheflow
5
8
  def self.activate
6
9
  require "cacheflow/memcached" if defined?(Dalli)
7
- require "cacheflow/redis" if defined?(Redis)
10
+ require "cacheflow/redis" if defined?(Redis) || defined?(RedisClient)
8
11
  end
9
12
 
10
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.1.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-13 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,107 +16,33 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
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: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: dalli
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: redis
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- description:
98
- email:
99
- - andrew@chartkick.com
26
+ version: '6'
27
+ description:
28
+ email: andrew@ankane.org
100
29
  executables: []
101
30
  extensions: []
102
31
  extra_rdoc_files: []
103
32
  files:
104
- - ".gitignore"
105
33
  - CHANGELOG.md
106
- - Gemfile
107
34
  - LICENSE.txt
108
35
  - README.md
109
- - Rakefile
110
- - cacheflow.gemspec
111
36
  - lib/cacheflow.rb
112
37
  - lib/cacheflow/memcached.rb
113
38
  - lib/cacheflow/railtie.rb
114
39
  - lib/cacheflow/redis.rb
115
40
  - lib/cacheflow/version.rb
116
41
  homepage: https://github.com/ankane/cacheflow
117
- licenses: []
42
+ licenses:
43
+ - MIT
118
44
  metadata: {}
119
- post_install_message:
45
+ post_install_message:
120
46
  rdoc_options: []
121
47
  require_paths:
122
48
  - lib
@@ -124,16 +50,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
50
  requirements:
125
51
  - - ">="
126
52
  - !ruby/object:Gem::Version
127
- version: '0'
53
+ version: '2.7'
128
54
  required_rubygems_version: !ruby/object:Gem::Requirement
129
55
  requirements:
130
56
  - - ">="
131
57
  - !ruby/object:Gem::Version
132
58
  version: '0'
133
59
  requirements: []
134
- rubyforge_project:
135
- rubygems_version: 2.6.13
136
- signing_key:
60
+ rubygems_version: 3.3.7
61
+ signing_key:
137
62
  specification_version: 4
138
63
  summary: Colorized logging for Memcached and Redis
139
64
  test_files: []
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in cacheflow.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
8
- end
9
-
10
- task default: :test
data/cacheflow.gemspec DELETED
@@ -1,29 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "cacheflow/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "cacheflow"
8
- spec.version = Cacheflow::VERSION
9
- spec.authors = ["Andrew Kane"]
10
- spec.email = ["andrew@chartkick.com"]
11
-
12
- spec.summary = "Colorized logging for Memcached and Redis"
13
- spec.homepage = "https://github.com/ankane/cacheflow"
14
-
15
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
- f.match(%r{^(test|spec|features)/})
17
- end
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
21
-
22
- spec.add_dependency "activesupport"
23
-
24
- spec.add_development_dependency "bundler"
25
- spec.add_development_dependency "rake"
26
- spec.add_development_dependency "minitest"
27
- spec.add_development_dependency "dalli"
28
- spec.add_development_dependency "redis"
29
- end