double_write_cache_stores 0.3.0 → 0.5.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
- SHA1:
3
- metadata.gz: 2f2e06c115f9f6f2c93e70bd217a9f0d2277e4b8
4
- data.tar.gz: 026266132650bcfe4a9b11f8a7ea78cbaeaaceeb
2
+ SHA256:
3
+ metadata.gz: '09e3ef0241622ad655a775f6eb0cbb8ad558449935e2fcc3e023f1ab9afcc3b7'
4
+ data.tar.gz: 0ab94920920dc1d8debbae83a303a647a8730b8a066755990274b76498a6bae8
5
5
  SHA512:
6
- metadata.gz: 7abdfd76502de8e42de745dbdd1ab4c729a126e3154e0572383720c70a27d06cd6e0e5e072963c57aaa8e1ca9833c81a4686278a489535e0b28d12e93735d2d7
7
- data.tar.gz: 4ffd5deef56bd569014e711abf799c39217f2ae484c0ebc612d8868626a9f2152be6ac62c12f6a62f32c948c133ed24f7ac23788a681d8f47d6507efae24868b
6
+ metadata.gz: f728dd727b40ad69ce8238fcfe9c0ca8826612c16bdf8b7a870c4396a2eab3991a388b436d2fdd03ccefa913b6343603e114f5b408fe40f92949d4ff5218bec8
7
+ data.tar.gz: 05004ee53248b487720fb6fff66f57288ab05090a94904f1a7ce52fce11c62cf3d630b038a7d45a793659845b259f91e340ab07197a80f168abf5d5b1e663548
data/.codeclimate.yml ADDED
@@ -0,0 +1,7 @@
1
+ languages:
2
+ Ruby: true
3
+ JavaScript: false
4
+ Python: false
5
+ PHP: false
6
+ exclude_paths:
7
+ - "vendor/*"
@@ -0,0 +1,60 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ concurrency:
8
+ group: ${{ github.workflow }}-${{ github.ref }}
9
+ cancel-in-progress: true
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ ruby:
18
+ - "2.5"
19
+ - "2.6"
20
+ - "2.7"
21
+ - "3.0"
22
+ - "3.1"
23
+ - "3.2"
24
+ gemfile:
25
+ - gemfiles/activesupport_5_2.gemfile
26
+ - gemfiles/activesupport_6_0.gemfile
27
+ - gemfiles/activesupport_6_1.gemfile
28
+ - gemfiles/activesupport_7_0.gemfile
29
+ - gemfiles/without_activesupport.gemfile
30
+ exclude:
31
+ - ruby: "2.5"
32
+ gemfile: gemfiles/activesupport_7_0.gemfile
33
+ - ruby: "2.6"
34
+ gemfile: gemfiles/activesupport_7_0.gemfile
35
+ - ruby: "3.0"
36
+ gemfile: gemfiles/activesupport_5_2.gemfile
37
+ - ruby: "3.0"
38
+ gemfile: gemfiles/activesupport_5_2.gemfile
39
+ - ruby: "3.1"
40
+ gemfile: gemfiles/activesupport_5_2.gemfile
41
+ - ruby: "3.2"
42
+ gemfile: gemfiles/activesupport_5_2.gemfile
43
+ services:
44
+ memcached_11211:
45
+ image: memcached
46
+ ports:
47
+ - 11211:11211
48
+ memcached_21211:
49
+ image: memcached
50
+ ports:
51
+ - 21211:11211
52
+ env:
53
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
54
+ steps:
55
+ - uses: actions/checkout@v4
56
+ - uses: ruby/setup-ruby@v1
57
+ with:
58
+ ruby-version: ${{ matrix.ruby }}
59
+ bundler-cache: true
60
+ - run: bundle exec rake
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/version_tmp
17
17
  tmp
18
18
  bin/
19
19
  vendor
20
+ /gemfiles/*.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,91 @@
1
+ AllCops:
2
+ Exclude:
3
+ - "vendor/**/*"
4
+ DisplayCopNames: true
5
+ NewCops: disable
6
+ TargetRubyVersion: 2.5
7
+ SuggestExtensions: false
8
+
9
+ Style/AsciiComments:
10
+ Enabled: false
11
+
12
+ Style/Documentation:
13
+ Enabled: false
14
+
15
+ Layout/ExtraSpacing:
16
+ Enabled: false
17
+
18
+ Style/GuardClause:
19
+ MinBodyLength: 5
20
+
21
+ Style/MethodDefParentheses:
22
+ EnforcedStyle: require_parentheses
23
+
24
+ Style/ModuleFunction:
25
+ Enabled: false
26
+
27
+ Style/StringLiterals:
28
+ EnforcedStyle: double_quotes
29
+
30
+ Layout/SpaceBeforeFirstArg:
31
+ Enabled: false
32
+
33
+ Layout/IndentationConsistency:
34
+ EnforcedStyle: indented_internal_methods
35
+
36
+ Style/SignalException:
37
+ EnforcedStyle: only_raise
38
+
39
+ Style/HashSyntax:
40
+ EnforcedStyle: ruby19_no_mixed_keys
41
+ Exclude:
42
+ - "**/*.rake"
43
+ - "Rakefile"
44
+
45
+ Layout/LineLength:
46
+ Max: 160
47
+
48
+ Style/NumericLiterals:
49
+ MinDigits: 7
50
+
51
+ Lint/AssignmentInCondition:
52
+ Enabled: false
53
+
54
+ Layout/BlockAlignment:
55
+ Enabled: false
56
+
57
+ Metrics/MethodLength:
58
+ Enabled: false
59
+
60
+ Style/FrozenStringLiteralComment:
61
+ Enabled: false
62
+
63
+ Style/NestedParenthesizedCalls:
64
+ Enabled: false
65
+
66
+ Metrics/BlockLength:
67
+ Enabled: false
68
+
69
+ Layout/EmptyLineAfterGuardClause:
70
+ Enabled: false
71
+
72
+ Style/MutableConstant:
73
+ Enabled: false
74
+
75
+ Style/ExpandPathArguments:
76
+ Enabled: false
77
+
78
+ Style/Alias:
79
+ Enabled: false
80
+
81
+ Style/SafeNavigation:
82
+ Enabled: false
83
+
84
+ Style/IfUnlessModifier:
85
+ Enabled: false
86
+
87
+ Style/ExplicitBlockArgument:
88
+ Enabled: false
89
+
90
+ Lint/AmbiguousBlockAssociation:
91
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.3
data/Appraisals ADDED
@@ -0,0 +1,18 @@
1
+ appraise "without_activesupport" do
2
+ end
3
+
4
+ appraise "activesupport_5_2" do
5
+ gem "activesupport", "~> 5.2.8.1"
6
+ end
7
+
8
+ appraise "activesupport_6_0" do
9
+ gem "activesupport", "~> 6.0.6.1"
10
+ end
11
+
12
+ appraise "activesupport_6_1" do
13
+ gem "activesupport", "~> 6.1.7.7"
14
+ end
15
+
16
+ appraise "activesupport_7_0" do
17
+ gem "activesupport", "~> 7.0.8.1"
18
+ end
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in double_write_cache_stores.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -1,17 +1,13 @@
1
1
  # DoubleWriteCacheStores
2
2
 
3
- pre-warning(double write to cach store and other cache store) cache store wrapper. will switch cache store.
3
+ [![test](https://github.com/mixigroup/double_write_cache_stores/actions/workflows/test.yml/badge.svg)](https://github.com/mixigroup/double_write_cache_stores/actions/workflows/test.yml)
4
4
 
5
- ## Convertible interface, get/set by cache store
6
-
7
- - Padrino::Cache(moneta)
8
- - ActiveSupport::Cache::DalliStore(Dalli)
9
- - Padrino::Cache::Store::Memcache
5
+ pre-warming(double write to cach store and other cache store) cache store wrapper. will switch cache store.
10
6
 
11
7
  ## Support backend cache store
12
8
 
13
- - ActiveSupport::Cache::DalliStore(Dalli)
14
- - Padrino::Cache::Store::Memcache
9
+ - ActiveSupport::Cache::MemCacheStore
10
+ - Dalli::Client
15
11
 
16
12
  ## Installation
17
13
 
@@ -32,6 +28,7 @@ Or install it yourself as:
32
28
  ### Padrino
33
29
 
34
30
  `config/apps.rb`
31
+
35
32
  ````
36
33
  read_and_write_cache_store = ActiveSupport::Cache.lookup_store :dalli_store, 'localhost:11211'
37
34
  write_only_cache_store = ActiveSupport::Cache.lookup_store :dalli_store, 'localhost:21211'
@@ -44,10 +41,14 @@ set :cache, DoubleWriteCacheStores::Client.new(read_and_write_cache_store, write
44
41
  `config/application.rb`
45
42
 
46
43
  ```ruby
47
- read_and_write_cache_store = ActiveSupport::Cache.lookup_store :mem_cache_store, 'localhost:11211'
48
- write_only_cache_store = ActiveSupport::Cache.lookup_store :mem_cache_store, 'localhost:21211'
44
+ options = { expires_in: 1.week, compress: true }
45
+
46
+ read_and_write_cache_store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost:11211", options
47
+ config.middleware.insert_before "Rack::Runtime", read_and_write_cache_store.middleware
48
+
49
+ write_only_cache_store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost:21211", options
49
50
 
50
- config.cache_store = DoubleWriteCacheStores::Client.new(read_and_write_cache_store, write_only_cache_store)
51
+ config.cache_store = DoubleWriteCacheStores::Client.new read_and_write_cache_store, write_only_cache_store
51
52
  ```
52
53
 
53
54
  #### in application
@@ -58,9 +59,23 @@ Rails.cache.fetch("key") do
58
59
  end
59
60
  ```
60
61
 
62
+ ## Run tests locally
63
+
64
+ ```
65
+ docker compose up -d
66
+ bundle install
67
+ bundle exec appraisal install
68
+ bundle exec appraisal activesupport_7_0 rake
69
+
70
+ #bundle exec appraisal activesupport_5_2 rake
71
+ #bundle exec appraisal activesupport_6_0 rake
72
+ #bundle exec appraisal activesupport_6_1 rake
73
+ #bundle exec appraisal without_activesupport rake
74
+ ```
75
+
61
76
  ## Contributing
62
77
 
63
- 1. Fork it ( http://github.com/hirocaster/double_write_cache_stores/fork )
78
+ 1. Fork it ( http://github.com/mixigroup/double_write_cache_stores/fork )
64
79
  2. Create your feature branch (`git checkout -b my-new-feature`)
65
80
  3. Commit your changes (`git commit -am 'Add some feature'`)
66
81
  4. Push to the branch (`git push origin my-new-feature`)
data/Rakefile CHANGED
@@ -1,6 +1,11 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
+ require "rubocop/rake_task"
3
4
 
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
6
- task :default => :spec
7
+ RuboCop::RakeTask.new do |task|
8
+ task.options = %w[-c .rubocop.yml]
9
+ end
10
+
11
+ task default: %i[rubocop spec]
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "activesupport"
4
+ gem "rack"
5
+
6
+ # Specify your gem's dependencies in active_record_sharding.gemspec
7
+ gemspec
@@ -0,0 +1,62 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ double_write_cache_stores (0.4.0)
5
+ dalli (~> 2.7.4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (4.2.4)
11
+ i18n (~> 0.7)
12
+ json (~> 1.7, >= 1.7.7)
13
+ minitest (~> 5.1)
14
+ thread_safe (~> 0.3, >= 0.3.4)
15
+ tzinfo (~> 1.1)
16
+ coderay (1.1.0)
17
+ dalli (2.7.4)
18
+ diff-lcs (1.2.5)
19
+ i18n (0.7.0)
20
+ json (1.8.3)
21
+ method_source (0.8.2)
22
+ minitest (5.8.2)
23
+ pry (0.10.3)
24
+ coderay (~> 1.1.0)
25
+ method_source (~> 0.8.1)
26
+ slop (~> 3.4)
27
+ rack (1.6.4)
28
+ rake (10.4.2)
29
+ rspec (3.3.0)
30
+ rspec-core (~> 3.3.0)
31
+ rspec-expectations (~> 3.3.0)
32
+ rspec-mocks (~> 3.3.0)
33
+ rspec-core (3.3.2)
34
+ rspec-support (~> 3.3.0)
35
+ rspec-expectations (3.3.1)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.3.0)
38
+ rspec-mocks (3.3.2)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.3.0)
41
+ rspec-support (3.3.0)
42
+ slop (3.6.0)
43
+ thread_safe (0.3.5)
44
+ tilt (1.3.7)
45
+ tzinfo (1.2.2)
46
+ thread_safe (~> 0.1)
47
+
48
+ PLATFORMS
49
+ ruby
50
+
51
+ DEPENDENCIES
52
+ activesupport
53
+ bundler (~> 1.5)
54
+ double_write_cache_stores!
55
+ pry
56
+ rack
57
+ rake
58
+ rspec
59
+ tilt (= 1.3.7)
60
+
61
+ BUNDLED WITH
62
+ 1.10.6
data/compose.yaml ADDED
@@ -0,0 +1,9 @@
1
+ services:
2
+ memcached_11211:
3
+ image: memcached
4
+ ports:
5
+ - "11211:11211"
6
+ memcached_21211:
7
+ image: memcached
8
+ ports:
9
+ - "21211:11211"
@@ -1,29 +1,31 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'double_write_cache_stores/version'
3
+ require "double_write_cache_stores/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "double_write_cache_stores"
8
7
  spec.version = DoubleWriteCacheStores::VERSION
9
8
  spec.authors = ["hirocaster"]
10
9
  spec.email = ["hohtsuka@gmail.com"]
11
- spec.summary = %q{ Double write cache stores wrapper. }
12
- spec.description = %q{ pre-warning(double write to cach store and other cache store) cache store wrapper. will switch cache store. }
10
+ spec.summary = "Double write cache stores wrapper."
11
+ spec.description = "pre-warming(double write to cach store and other cache store) cache store wrapper. will switch cache store."
13
12
  spec.homepage = ""
14
13
  spec.license = "MIT"
15
14
 
16
- spec.files = `git ls-files`.split($/)
15
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
18
  spec.require_paths = ["lib"]
20
19
 
21
- spec.add_development_dependency "bundler", "~> 1.5"
20
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5")
21
+
22
+ spec.add_runtime_dependency "dalli", "~> 3.0"
23
+
24
+ spec.add_development_dependency "appraisal", "~> 2.5.0"
25
+ spec.add_development_dependency "bundler", "~> 2.0"
26
+ spec.add_development_dependency "pry"
22
27
  spec.add_development_dependency "rake"
23
28
  spec.add_development_dependency "rspec"
24
- spec.add_development_dependency "activesupport", "= 3.2.15"
25
- spec.add_development_dependency "dalli", "= 2.7.0"
26
- spec.add_development_dependency "pry"
27
- spec.add_development_dependency "padrino", "0.10.7"
29
+ spec.add_development_dependency "rubocop"
28
30
  spec.add_development_dependency "tilt", "1.3.7"
29
31
  end
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 5.2.8.1"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 6.0.6.1"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 6.1.7.7"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 7.0.8.1"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,5 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec path: "../"