redis-cluster-activesupport 0.3.0 → 1.0.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: 9c2b7e78ca8bd0ada90cec317b5dc94d873b8bab5acaf53ef977a5fe5547ed01
4
- data.tar.gz: ab1d27d5bff09f5b000e27be5770c17c56a45b4abe23ccb791193197fdf2d530
3
+ metadata.gz: 0c5866199404c1afb551f773eee43d2f6590732581a0f804813d9ef8ddca0ae5
4
+ data.tar.gz: 78e6603647d4e490b783354357ced8ce5dfcd42d4be7e3671e5bd2eecac09017
5
5
  SHA512:
6
- metadata.gz: 7ff0bf540fda905d6adbd5873dd00b25cfac316d27c134370d266b64584186f51b0c276d4f4161a7ada54556556dbac9c10f01774df40bace2e726b76c883be9
7
- data.tar.gz: bc9d4c043f68d65d4399c07db9581e36f15ebf37be2103e4d257f44f1a679da8c4acfb9f78d4e7b0f80bdc0d034d443ac8956bf91b1d8e0995d53ef60034ac1f
6
+ metadata.gz: cbf4f992e5a52c00c512ace7ef29e7a39adbb87cb8df032c9497f1d50339ec399547a98b64e90ebfc9acfd0c8d7de8e2a0bb9ac31235b255eebe521dd3e5541c
7
+ data.tar.gz: ed4af5ebf896fac0452462c47f3aa37db61acdd5583ae82f4a6e58139fbf72e69c7d463a310ede8d95dbfc1d0af752bbb322181d753ce79e60bbe1de1f3f9660
@@ -0,0 +1,37 @@
1
+ # This workflow uses actions that are not certified by GitHub. They are
2
+ # provided by a third-party and are governed by separate terms of service,
3
+ # privacy policy, and support documentation.
4
+ #
5
+ # This workflow will install a prebuilt Ruby version, install dependencies, and
6
+ # run tests and linters.
7
+ name: "redis-cluster-activesupport"
8
+ on:
9
+ push:
10
+ branches: [ master ]
11
+ pull_request:
12
+ branches: [ master ]
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ ruby-version: [ '3.2', '3.1', '3.0', '2.7', '2.6', 'jruby-9.3', 'jruby-9.4' ]
19
+ gemfile: [ 'rails60', 'rails61' ]
20
+ env:
21
+ RAILS_ENV: test
22
+ steps:
23
+ - name: Checkout code
24
+ uses: actions/checkout@v3
25
+ # Add or replace dependency steps here
26
+ - name: Install Ruby and gems
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ bundler-cache: true
30
+ ruby-version: ${{ matrix.ruby-version }}
31
+ env:
32
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
33
+ # Add or replace test runners here
34
+ - name: Run tests
35
+ run: bundle exec rspec
36
+ env:
37
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
data/.travis.yml CHANGED
@@ -1,7 +1,15 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.4
4
- - 2.3
3
+ - jruby-9.4
4
+ - jruby-9.3
5
+ - 3.2
6
+ - 3.1
7
+ - 3.0
8
+ - 2.7
9
+ - 2.6
10
+ gemfile:
11
+ - gemfiles/rails60.gemfile
12
+ - gemfiles/rails61.gemfile
5
13
  sudo: false
6
14
  cache: bundler
7
15
  notifications:
data/README.md CHANGED
@@ -1,12 +1,13 @@
1
1
  # Redis cluster stores for ActiveSupport [![Build Status](https://travis-ci.org/film42/redis-cluster-activesupport.svg?branch=master)](https://travis-ci.org/film42/redis-cluster-activesupport)
2
2
 
3
- This gem is an extension to [redis-activesupport](https://github.com/redis-store/redis-activesupport) that adds support
3
+ This gem was an extension to [redis-activesupport](https://github.com/redis-store/redis-activesupport) that adds support
4
4
  for a few features required to use `redis-store` with redis cluster. Right now there isn't an official redis cluster
5
- client in ruby, so it's become common to use a redis cluster proxy like [corvus](https://github.com/eleme/corvus). When
5
+ client in ruby, so it's become common to use a redis cluster proxy like [corvus](https://github.com/eleme/corvus) or Envoy. When
6
6
  switching there are a few things you can't do with redis cluster that you can do with a single redis server. Most of
7
7
  them revolve around issuing commands with multiple keys. In redis cluster, your keys are partitioned and live on
8
- different physical servers, operations like `KEYS` are not possible. Corvus will break apart `MSET` and `MGET` into
9
- individual `GET` and `SET` commands automatically, but in general, it's not a good idea to use them.
8
+ different physical servers, operations like `KEYS` are not possible.
9
+
10
+ This is now leveraging Rails 6's built-in redis cache store with troubled commands removed.
10
11
 
11
12
  ## Usage
12
13
 
@@ -21,30 +22,6 @@ module MyProject
21
22
  end
22
23
  ```
23
24
 
24
- Additionally, there's a new configuration option: `:ignored_command_errors`. This is useful if you're using a redis
25
- cluster proxy like corvus who will raise a `Redis::CommandError` with a message indicating the cluster is offline or
26
- experiencing a partial outage. This extension allows you to whitelist certain `ignored_command_errors` that would
27
- normally be raised by `redis-activesupport`. By default this gem whitelists the following errors:
28
-
29
- ```ruby
30
- DEFAULT_IGNORED_COMMAND_ERRORS = ["ERR Proxy error"]
31
- ```
32
-
33
- If you need additional errors added to the whitelist, you can do this through your own configuration or open a pull
34
- request to add it to the default whitelist. NOTE: this list is turned into a `Set` to keep lookups fast, so feel free to
35
- make this list as big as you need. Example:
36
-
37
- ```ruby
38
- module MyProject
39
- class Application < Rails::Application
40
- config.cache_store = :redis_cluster_store, {:ignored_command_errors => ["Uh oh", "Please, stop", "Fire emoji"]}
41
- end
42
- end
43
- ```
44
-
45
- With this change, your cache store will now silently fail once again so a redis cluster won't knock your rails apps
46
- offline.
47
-
48
25
 
49
26
  ## Installation
50
27
 
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "activesupport", "~> 6.0.0"
4
+ gemspec path: "../"
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ redis-cluster-activesupport (0.3.0)
5
+ activesupport (~> 6.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (6.0.6.1)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 0.7, < 2)
13
+ minitest (~> 5.1)
14
+ tzinfo (~> 1.1)
15
+ zeitwerk (~> 2.2, >= 2.2.2)
16
+ coderay (1.1.3)
17
+ concurrent-ruby (1.2.0)
18
+ diff-lcs (1.5.0)
19
+ fakeredis (0.8.0)
20
+ redis (~> 4.1)
21
+ ffi (1.15.5-java)
22
+ i18n (1.12.0)
23
+ concurrent-ruby (~> 1.0)
24
+ method_source (1.0.0)
25
+ minitest (5.17.0)
26
+ pry (0.14.2)
27
+ coderay (~> 1.1)
28
+ method_source (~> 1.0)
29
+ pry (0.14.2-java)
30
+ coderay (~> 1.1)
31
+ method_source (~> 1.0)
32
+ spoon (~> 0.0)
33
+ rake (10.5.0)
34
+ redis (4.8.0)
35
+ rspec (3.12.0)
36
+ rspec-core (~> 3.12.0)
37
+ rspec-expectations (~> 3.12.0)
38
+ rspec-mocks (~> 3.12.0)
39
+ rspec-core (3.12.1)
40
+ rspec-support (~> 3.12.0)
41
+ rspec-expectations (3.12.2)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.12.0)
44
+ rspec-mocks (3.12.3)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.12.0)
47
+ rspec-support (3.12.0)
48
+ spoon (0.0.6)
49
+ ffi
50
+ thread_safe (0.3.6)
51
+ thread_safe (0.3.6-java)
52
+ tzinfo (1.2.11)
53
+ thread_safe (~> 0.1)
54
+ zeitwerk (2.6.6)
55
+
56
+ PLATFORMS
57
+ universal-java-1.8
58
+ universal-java-11
59
+ x86_64-linux
60
+
61
+ DEPENDENCIES
62
+ activesupport (~> 6.0.0)
63
+ bundler
64
+ fakeredis
65
+ pry
66
+ rake (~> 10.0)
67
+ redis-cluster-activesupport!
68
+ rspec (~> 3.0)
69
+
70
+ BUNDLED WITH
71
+ 2.4.6
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "activesupport", "~> 6.1.0"
4
+ gemspec path: "../"
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ redis-cluster-activesupport (0.3.0)
5
+ activesupport (~> 6.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (6.1.7.2)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ zeitwerk (~> 2.3)
16
+ coderay (1.1.3)
17
+ concurrent-ruby (1.2.0)
18
+ diff-lcs (1.5.0)
19
+ fakeredis (0.8.0)
20
+ redis (~> 4.1)
21
+ ffi (1.15.5-java)
22
+ i18n (1.12.0)
23
+ concurrent-ruby (~> 1.0)
24
+ method_source (1.0.0)
25
+ minitest (5.17.0)
26
+ pry (0.14.2)
27
+ coderay (~> 1.1)
28
+ method_source (~> 1.0)
29
+ pry (0.14.2-java)
30
+ coderay (~> 1.1)
31
+ method_source (~> 1.0)
32
+ spoon (~> 0.0)
33
+ rake (10.5.0)
34
+ redis (4.8.0)
35
+ rspec (3.12.0)
36
+ rspec-core (~> 3.12.0)
37
+ rspec-expectations (~> 3.12.0)
38
+ rspec-mocks (~> 3.12.0)
39
+ rspec-core (3.12.1)
40
+ rspec-support (~> 3.12.0)
41
+ rspec-expectations (3.12.2)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.12.0)
44
+ rspec-mocks (3.12.3)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.12.0)
47
+ rspec-support (3.12.0)
48
+ spoon (0.0.6)
49
+ ffi
50
+ tzinfo (2.0.6)
51
+ concurrent-ruby (~> 1.0)
52
+ zeitwerk (2.6.6)
53
+
54
+ PLATFORMS
55
+ universal-java-1.8
56
+ universal-java-11
57
+ x86_64-linux
58
+
59
+ DEPENDENCIES
60
+ activesupport (~> 6.1.0)
61
+ bundler
62
+ fakeredis
63
+ pry
64
+ rake (~> 10.0)
65
+ redis-cluster-activesupport!
66
+ rspec (~> 3.0)
67
+
68
+ BUNDLED WITH
69
+ 2.4.6
@@ -1,26 +1,8 @@
1
- require "redis-activesupport"
2
- require "set"
1
+ require "active_support"
3
2
 
4
3
  module ActiveSupport
5
4
  module Cache
6
- class RedisClusterStore < RedisStore
7
- attr_reader :ignored_command_errors
8
-
9
- DEFAULT_IGNORED_COMMAND_ERRORS = ["ERR Proxy error"].freeze
10
-
11
- def initialize(*)
12
- super
13
- @ignored_command_errors = ::Set.new(@options.fetch(:ignored_command_errors, DEFAULT_IGNORED_COMMAND_ERRORS))
14
- end
15
-
16
- def delete_entry(key, options)
17
- super
18
- rescue Redis::CommandError => error
19
- raise unless ignored_command_errors.include?(error.message)
20
- raise if raise_errors?
21
- false
22
- end
23
-
5
+ class RedisClusterStore < RedisCacheStore
24
6
  def delete_matched(matcher, options = nil)
25
7
  fail ::NotImplementedError, "Deleting keys with a matcher is not supported with redis cluster"
26
8
  end
@@ -48,22 +30,6 @@ module ActiveSupport
48
30
  end
49
31
  end
50
32
 
51
- def read_entry(key, options)
52
- super
53
- rescue Redis::CommandError => error
54
- raise unless ignored_command_errors.include?(error.message)
55
- raise if raise_errors?
56
- nil
57
- end
58
-
59
- def write_entry(key, entry, options)
60
- super
61
- rescue Redis::CommandError => error
62
- raise unless ignored_command_errors.include?(error.message)
63
- raise if raise_errors?
64
- false
65
- end
66
-
67
33
  private
68
34
 
69
35
  def _expires_in(options)
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "redis-cluster-activesupport"
6
- spec.version = "0.3.0"
6
+ spec.version = "1.0.0"
7
7
  spec.authors = ["Garrett Thornburg"]
8
8
  spec.email = ["film42@gmail.com"]
9
9
 
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "redis-activesupport"
23
- spec.add_development_dependency "bundler", "~> 1.15"
22
+ spec.add_dependency "activesupport", "~> 6.0"
23
+ spec.add_development_dependency "bundler"
24
24
  spec.add_development_dependency "fakeredis"
25
25
  spec.add_development_dependency "pry"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-cluster-activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garrett Thornburg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-14 00:00:00.000000000 Z
11
+ date: 2023-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: redis-activesupport
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '6.0'
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'
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.15'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.15'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: fakeredis
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -101,6 +101,7 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - ".github/workflows/ci.yml"
104
105
  - ".gitignore"
105
106
  - ".rspec"
106
107
  - ".travis.yml"
@@ -110,6 +111,10 @@ files:
110
111
  - Rakefile
111
112
  - bin/console
112
113
  - bin/setup
114
+ - gemfiles/rails60.gemfile
115
+ - gemfiles/rails60.gemfile.lock
116
+ - gemfiles/rails61.gemfile
117
+ - gemfiles/rails61.gemfile.lock
113
118
  - lib/active_support/cache/redis_cluster_store.rb
114
119
  - lib/redis/cluster/activesupport.rb
115
120
  - redis-cluster-activesupport.gemspec
@@ -132,8 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
137
  - !ruby/object:Gem::Version
133
138
  version: '0'
134
139
  requirements: []
135
- rubyforge_project:
136
- rubygems_version: 2.7.6
140
+ rubygems_version: 3.1.6
137
141
  signing_key:
138
142
  specification_version: 4
139
143
  summary: Extension to redis-activesupport for working with redis cluster