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 +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +6 -3
- data/lib/active_support/cache/smart_mem_cache.rb +2 -2
- data/lib/active_support/cache/smart_redis_cache.rb +11 -2
- data/lib/smart_cache_store/version.rb +1 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3255f6928a9b8e6a102b210749f0b31dea04654f583f4679832019d84f6f490a
|
4
|
+
data.tar.gz: 03bee6a696eb0cfbcb5a1517818888ea866dc65b33a54a6b7c95cdad7efe2e9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3922f820e7b655a38a8ec5e688c8c18fab6a66ae499e9d01edc14fb1f9cb3c5d424456ffb2a0bcf89aaf4e4d1462fe63672baeb800902662ceecc1338853b275
|
7
|
+
data.tar.gz: 87579ff4140abe65b6f2f402e720f43ffda8137333821410b10ea1aab0ce11e34e55eb3a5802376f3f2238e19b9bce30b7e26072c4a35fa2411df81433a862d9
|
data/LICENSE.txt
CHANGED
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:
|
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
|
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.
|
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.
|
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)
|
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.
|
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:
|
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
|
-
|
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.
|
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
|