smart_cache_store 0.1.0 → 0.2.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: 5afc7011d21ae7f81c857be6283535b4d036eb126a2a890412c1f98fca5f914a
4
- data.tar.gz: cdc421218f4a6963adbd0f7074c83cfa277d3986f29915482b45dc5ff911e8c0
3
+ metadata.gz: 3255f6928a9b8e6a102b210749f0b31dea04654f583f4679832019d84f6f490a
4
+ data.tar.gz: 03bee6a696eb0cfbcb5a1517818888ea866dc65b33a54a6b7c95cdad7efe2e9c
5
5
  SHA512:
6
- metadata.gz: 70b98d97da2015b7fd4512cf40fdf89aa0b1f3de7b70193cc7db315aaca6055d2754c4dbcd0c465018f9db3866faa48387c76d47eecab9914128f956c2bad5a1
7
- data.tar.gz: '08e1b0c805e7343bf4b07cadbb0703ae7d1383888175246b526f89c85f2cda95f707fae42b7c36712c7d96b4eb7c68bae1d78afb5f0adc8597a6588bb9c4bfd7'
6
+ metadata.gz: 3922f820e7b655a38a8ec5e688c8c18fab6a66ae499e9d01edc14fb1f9cb3c5d424456ffb2a0bcf89aaf4e4d1462fe63672baeb800902662ceecc1338853b275
7
+ data.tar.gz: 87579ff4140abe65b6f2f402e720f43ffda8137333821410b10ea1aab0ce11e34e55eb3a5802376f3f2238e19b9bce30b7e26072c4a35fa2411df81433a862d9
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2021 thomas morgan
1
+ Copyright 2021-2022 thomas morgan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -15,8 +15,7 @@ Set by default:
15
15
  connect_timeout: 2
16
16
  read_timeout: 1
17
17
  write_timeout: 1
18
- reconnect_attempts: 1
19
- reconnect_delay: 0.2
18
+ reconnect_attempts: [0.2]
20
19
 
21
20
  `:url` should be a uri, like: `redis://localhost:6379/0`. For two or more uris, combine with a comma: `redis://host-a,redis://host-b`.
22
21
 
@@ -67,9 +66,13 @@ In `environment/[env].rb`:
67
66
 
68
67
 
69
68
  ## Installation
70
- Add this line to your application's Gemfile:
69
+ Add `smart_cache_store` plus one driver to your application's Gemfile:
71
70
 
72
71
  ```ruby
72
+ gem 'redis' # for redis; gem v4.x or 5.x
73
+ # OR
74
+ gem 'dalli' # for memcache
75
+
73
76
  gem "smart_cache_store"
74
77
  ```
75
78
 
@@ -44,7 +44,7 @@ module ActiveSupport
44
44
  options = merged_options(options)
45
45
  instrument(:increment, name, amount: amount) do
46
46
  rescue_error_with nil do
47
- @data.with { |c| c.incr(normalize_key(name, options), amount, options[:expires_in], amount) }
47
+ @data.then { |c| c.incr(normalize_key(name, options), amount, options[:expires_in], amount) }
48
48
  end
49
49
  end
50
50
  end
@@ -53,7 +53,7 @@ module ActiveSupport
53
53
  options = merged_options(options)
54
54
  instrument(:decrement, name, amount: amount) do
55
55
  rescue_error_with nil do
56
- @data.with { |c| c.decr(normalize_key(name, options), amount, options[:expires_in], 0) }
56
+ @data.then { |c| c.decr(normalize_key(name, options), amount, options[:expires_in], 0) }
57
57
  end
58
58
  end
59
59
  end
@@ -32,9 +32,18 @@ module ActiveSupport
32
32
  connect_timeout: 2,
33
33
  read_timeout: 1,
34
34
  write_timeout: 1,
35
- reconnect_attempts: 1,
36
- reconnect_delay: 0.2,
37
35
  )
36
+ if Redis::VERSION >= '5'
37
+ args.reverse_merge!(
38
+ # when an array, contains delay for each reconnect attempt
39
+ reconnect_attempts: [0.2]
40
+ )
41
+ else
42
+ args.reverse_merge!(
43
+ reconnect_attempts: 1,
44
+ reconnect_delay: 0.2,
45
+ )
46
+ end
38
47
  args[:url] ||= ENV['REDIS_URL'] unless args.key?(:redis) || args.key?(:url)
39
48
  args[:url] = args[:url].split(',') if args[:url].is_a?(String)
40
49
  super(**args)
@@ -1,3 +1,3 @@
1
1
  module SmartCacheStore
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_cache_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-18 00:00:00.000000000 Z
11
+ date: 2022-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,7 +24,22 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.2'
27
- description:
27
+ - !ruby/object:Gem::Dependency
28
+ name: connection_pool
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.2.4
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 2.2.4
41
+ description: Production-ready enhancements for mem_cache_store and redis_cache_store.
42
+ For Rails or ActiveSupport.
28
43
  email:
29
44
  - tm@iprog.com
30
45
  executables: []
@@ -60,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
75
  - !ruby/object:Gem::Version
61
76
  version: '0'
62
77
  requirements: []
63
- rubygems_version: 3.2.22
78
+ rubygems_version: 3.2.33
64
79
  signing_key:
65
80
  specification_version: 4
66
81
  summary: Production-ready enhancements for mem_cache_store and redis_cache_store