redis-activesupport 5.0.4 → 5.0.5

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
  SHA1:
3
- metadata.gz: 33df3ef09a75d9ce2b545efe032cd801d2437eea
4
- data.tar.gz: 807b5a494112c947faaacd3c47090004e47ffc5a
3
+ metadata.gz: c3b0c9c08812e36f2dffac848245c0bcc15d7dc7
4
+ data.tar.gz: 402843532853000850b53950016066539773c629
5
5
  SHA512:
6
- metadata.gz: 3bdafb650c1a86020859524d0d9f66c3d9d6f2e1b6772525d05a9f6574fbfca702bdc9fbc404c1581ea94b06e9c2c7b309faf0c73f7d6a674197d1688ae2df3e
7
- data.tar.gz: 1bd8ea70bc58ebfc4f89c2152590139bc516fea97e796fcdfd6657cacc78c53bc1e74ac522399bc1ebdca3ca783ee991ed9da8d5895285ce252635f06b950a66
6
+ metadata.gz: a5c72abe5df437b209a58f190decd3b06c23e9d47d31d099344dc12bd4b0925e2ea304402fb11e89bb034dfab3d15e21d896e8c08f5818c12f8bfed9f4da49da
7
+ data.tar.gz: 4967910fdab2b5042cca028ca56b4cc6435ccb71a32b8566914cf4b85885dbcd0ee02c33e6b3e83028d636fe16e149327058ba8768bcd2c5c7f4d61e60146289
@@ -22,3 +22,6 @@ matrix:
22
22
  gemfile: gemfiles/Gemfile.activesupport-5.x
23
23
  - rvm: 2.1
24
24
  gemfile: gemfiles/Gemfile.activesupport-5.x
25
+ notifications:
26
+ webhooks: https://www.travisbuddy.com/
27
+ on_success: never
data/README.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # Redis stores for ActiveSupport
2
2
 
3
- __`redis-activesupport`__ provides a cache for __ActiveSupport__. See the main [redis-store readme](https://github.com/redis-store/redis-store) for general guidelines.
3
+ __`redis-activesupport`__ provides a cache for __ActiveSupport__.
4
+
5
+
6
+ For guidelines on using our underlying cache store, see the main [redis-store readme](https://github.com/redis-store/redis-store).
7
+
8
+ For information on how to use this library in a Rails app, see the [documentation for redis-rails](https://github.com/redis-store/redis-rails).
9
+
10
+ If, for some reason, you're using `ActiveSupport::Cache` and not in a Rails app, read on to learn how to install/use this gem by itself!
11
+
12
+ ## A quick note about Rails 5.2
13
+
14
+ Rails 5.2.0 [includes a Redis cache store out of the
15
+ box](https://github.com/rails/rails/pull/31134), so you don't really
16
+ need this anymore if you're generating a new Rails application. We
17
+ are no longer accepting new features for this gem, only pull requests
18
+ for security and compatibility fixes will be accepted.
4
19
 
5
20
  ## Installation
6
21
 
@@ -20,6 +20,9 @@ module ActiveSupport
20
20
  # RedisStore.new
21
21
  # # => host: localhost, port: 6379, db: 0
22
22
  #
23
+ # RedisStore.new client: Redis.new(url: "redis://127.0.0.1:6380/1")
24
+ # # => host: localhost, port: 6379, db: 0
25
+ #
23
26
  # RedisStore.new "example.com"
24
27
  # # => host: example.com, port: 6379, db: 0
25
28
  #
@@ -42,8 +45,8 @@ module ActiveSupport
42
45
  # pool: ::ConnectionPool.new(size: 1, timeout: 1) { ::Redis::Store::Factory.create("localhost:6379/0") })
43
46
  # # => supply an existing connection pool (e.g. for use with redis-sentinel or redis-failover)
44
47
  def initialize(*addresses)
45
- @options = addresses.dup.extract_options!
46
- addresses = addresses.map(&:dup)
48
+ @options = addresses.extract_options!
49
+ addresses = addresses.compact.map(&:dup)
47
50
 
48
51
  @data = if @options[:pool]
49
52
  raise "pool must be an instance of ConnectionPool" unless @options[:pool].is_a?(ConnectionPool)
@@ -54,9 +57,11 @@ module ActiveSupport
54
57
  pool_options[:size] = options[:pool_size] if options[:pool_size]
55
58
  pool_options[:timeout] = options[:pool_timeout] if options[:pool_timeout]
56
59
  @pooled = true
57
- ::ConnectionPool.new(pool_options) { ::Redis::Store::Factory.create(*addresses) }
60
+ ::ConnectionPool.new(pool_options) { ::Redis::Store::Factory.create(*addresses, @options) }
61
+ elsif @options[:client]
62
+ @options[:client]
58
63
  else
59
- ::Redis::Store::Factory.create(*addresses)
64
+ ::Redis::Store::Factory.create(*addresses, @options)
60
65
  end
61
66
 
62
67
  super(@options)
@@ -1,5 +1,5 @@
1
1
  class Redis
2
2
  module ActiveSupport
3
- VERSION = '5.0.4'
3
+ VERSION = '5.0.5'
4
4
  end
5
5
  end
@@ -26,6 +26,13 @@ describe ActiveSupport::Cache::RedisStore do
26
26
  end
27
27
  end
28
28
 
29
+ it "uses redis client passed as an option" do
30
+ redis = Redis.new(url: "redis://127.0.0.1:6380/1")
31
+ store = ActiveSupport::Cache::RedisStore.new(client: redis)
32
+
33
+ store.data.must_equal(redis)
34
+ end
35
+
29
36
  it "connects using an hash of options" do
30
37
  address = { host: '127.0.0.1', port: '6380', db: '1' }
31
38
  store = ActiveSupport::Cache::RedisStore.new(address.merge(pool_size: 5, pool_timeout: 10))
@@ -91,6 +98,11 @@ describe ActiveSupport::Cache::RedisStore do
91
98
  underlying_store.must_be_instance_of(::Redis::Store)
92
99
  end
93
100
 
101
+ it "creates a normal store when given nil" do
102
+ underlying_store = instantiate_store nil
103
+ underlying_store.must_be_instance_of(::Redis::Store)
104
+ end
105
+
94
106
  it "creates a normal store when given options only" do
95
107
  underlying_store = instantiate_store(:expires_in => 1.second)
96
108
  underlying_store.must_be_instance_of(::Redis::Store)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.4
4
+ version: 5.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-16 00:00:00.000000000 Z
12
+ date: 2018-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis-store
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  requirements: []
186
186
  rubyforge_project: redis-activesupport
187
- rubygems_version: 2.6.11
187
+ rubygems_version: 2.6.14
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: Redis store for ActiveSupport