smart_cache_store 0.3.0 → 1.0.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: a4bdb9fe3fd3e37388a3acf6b3baf5add0cc5b54fc1a6ba0092c99c1526226b3
4
- data.tar.gz: 7ff024a2499dd5df7f42bdcbe9f6422eed0e50970e2a146d3d09c35b1fdd9bc6
3
+ metadata.gz: ed085fd68dc9527609bc2cf5cc538b40e902638155b202e485dac2db92f5c27b
4
+ data.tar.gz: b2281c651f5fbfd6f9c3c4feaaeafd7246075a1f001fe9a6d69ccc0af5aebc2a
5
5
  SHA512:
6
- metadata.gz: 66f840e0521852e358d1be01c186545f0bc920ded0e4509e211111d2f9a142b7464de4fc7032ef3c1d32fc714f4f2fb80593f8eccdd7d584ef6d0bae384c571c
7
- data.tar.gz: d15389db9cd657838aca3e8fd903e5a1e7a80c978aaca4ee710191acac5b8f5abf7b23a49631ac86efe2b78f6a4d16fc402f96c45d4f1832ebc8d6cf8912adf5
6
+ metadata.gz: 403228a667e55a3eecf3f619df9d6e30d26be0da899323396429d33d58e9adf6ddc6f90dc7b9afd6100d3dc9543031be72266c72e3b18a45b6fb59ccdd70c9ad
7
+ data.tar.gz: 0c6a0c160ffbec240e190ac032f27dd6dbb7ad7924e0c9b031693c962af98dc17727fe4787cd2825b73ae1464611d72479554ef14bc386345f75f23ce899b307
@@ -15,9 +15,10 @@ module ActiveSupport
15
15
 
16
16
  # known options:
17
17
  # ActiveSupport::Cache - universal options
18
- # :namespace{nil}, :compress{true}, :compress_threshold{1k}, :expires_in{0}, :race_condition_ttl{0}
18
+ # :namespace{nil}, :compress{true}, :compress_threshold{1k}, :coder, :expires_in{0}
19
+ # :race_condition_ttl{0}, :skip_nil{false}
19
20
  # ActiveSupport::Cache::Store
20
- # :pool{5}, :pool_timeout{5}
21
+ # pool: {:size{5}, :timeout{5}}
21
22
  # Dalli::Client
22
23
  # :failover{true}, :serializer{Marshall}, :compressor{zlib}, :cache_nils{false}
23
24
  # :namespace{nil}, :expires_in{0}, :compress{false} (separate from AS::C's same options above)
@@ -28,9 +29,13 @@ module ActiveSupport
28
29
  expires_in: 1.day,
29
30
  race_condition_ttl: 5.seconds,
30
31
  failover: true,
31
- pool: ENV.fetch('RAILS_MAX_THREADS'){ 5 }.to_i,
32
32
  )
33
- args.reverse_merge!(pool_size: args.delete(:pool)) if ActiveSupport.version < '7.1.0.a'
33
+ if ActiveSupport.version >= '7.1.0.a'
34
+ args[:pool] ||= {}
35
+ args[:pool][:size] ||= Integer(ENV.fetch('RAILS_MAX_THREADS'){ 5 })
36
+ else
37
+ args[:pool_size] ||= Integer(ENV.fetch('RAILS_MAX_THREADS'){ 5 })
38
+ end
34
39
  addresses.push Array(args.delete(:url)) if addresses.empty? && args.key?(:url)
35
40
  super(*addresses, args)
36
41
  end
@@ -46,7 +51,7 @@ module ActiveSupport
46
51
  options = merged_options(options)
47
52
  instrument(:increment, name, amount: amount) do
48
53
  rescue_error_with nil do
49
- @data.then { |c| c.incr(normalize_key(name, options), amount, options[:expires_in], amount) }
54
+ @data.with { |c| c.incr(normalize_key(name, options), amount, options[:expires_in], amount) }
50
55
  end
51
56
  end
52
57
  end
@@ -55,7 +60,7 @@ module ActiveSupport
55
60
  options = merged_options(options)
56
61
  instrument(:decrement, name, amount: amount) do
57
62
  rescue_error_with nil do
58
- @data.then { |c| c.decr(normalize_key(name, options), amount, options[:expires_in], 0) }
63
+ @data.with { |c| c.decr(normalize_key(name, options), amount, options[:expires_in], 0) }
59
64
  end
60
65
  end
61
66
  end
@@ -13,9 +13,12 @@ module ActiveSupport
13
13
 
14
14
  # known options:
15
15
  # ActiveSupport::Cache - universal options
16
- # :namespace{nil}, :compress{true}, :compress_threshold{1k}, :expires_in{0}, :race_condition_ttl{0}
16
+ # :namespace{nil}, :compress{true}, :compress_threshold{1k}, :coder, :expires_in{0}
17
+ # :race_condition_ttl{0}, :skip_nil{false}
17
18
  # ActiveSupport::Cache::Store
18
- # :pool{5}, :pool_timeout{5}
19
+ # pool: {:size{5}, :timeout{5}}
20
+ # ActiveSupport::Cache::RedisCacheStore
21
+ # :error_handler
19
22
  # Redis
20
23
  # :host, :port, :db, :username, :password, :url, :path
21
24
  # ssl_params: {:ca_file, :cert, :key}
@@ -28,12 +31,16 @@ module ActiveSupport
28
31
  namespace: ENV['REDIS_NAMESPACE'],
29
32
  expires_in: 1.day,
30
33
  race_condition_ttl: 5.seconds,
31
- pool: ENV.fetch('RAILS_MAX_THREADS'){ 5 }.to_i,
32
34
  connect_timeout: 2,
33
35
  read_timeout: 1,
34
36
  write_timeout: 1,
35
37
  )
36
- args.reverse_merge!(pool_size: args.delete(:pool)) if ActiveSupport.version < '7.1.0.a'
38
+ if ActiveSupport.version >= '7.1.0.a'
39
+ args[:pool] ||= {}
40
+ args[:pool][:size] ||= Integer(ENV.fetch('RAILS_MAX_THREADS'){ 5 })
41
+ else
42
+ args[:pool_size] ||= Integer(ENV.fetch('RAILS_MAX_THREADS'){ 5 })
43
+ end
37
44
  if Redis::VERSION >= '5'
38
45
  args.reverse_merge!(
39
46
  # when an array, contains delay for each reconnect attempt
@@ -1,3 +1,3 @@
1
1
  module SmartCacheStore
2
- VERSION = '0.3.0'
2
+ VERSION = '1.0.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.3.0
4
+ version: 1.0.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: 2023-01-07 00:00:00.000000000 Z
11
+ date: 2023-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '6.1'
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: '5.2'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: connection_pool
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.3.26
78
+ rubygems_version: 3.4.10
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Production-ready enhancements for mem_cache_store and redis_cache_store