stormpath-sdk 1.2.0 → 1.2.1

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
  SHA1:
3
- metadata.gz: 23386924f0b6cb041d80e4900d5cba99cc93da80
4
- data.tar.gz: 7e9d14180ef6f5e6fadfcb11836cf4e3ceca7ba5
3
+ metadata.gz: b3691a66f261c76c712cf287ab23eb915c8fbc9b
4
+ data.tar.gz: 23271526986e5b0ca026d6010f213c76534b88bd
5
5
  SHA512:
6
- metadata.gz: 15039329aa8f769f5b73bd763e2bb29df905a26f06782f7dcaac8cc17a5140f5244e2fb42d66d19afb4613d4dc833536c1e55994bc1e545e003a8252a858ffea
7
- data.tar.gz: be5240dbe085d0566b3a1e1fb4a8cc39c0b566d7b7958fa655b373834a7c98be4f4885d7cb74547e9f4158cccc595540d04bcf4859033d840e8186caa8638e5f
6
+ metadata.gz: 32a307a58bee08d85c5595e4d9889f2ff4d0dda416dc91f57c91edd7fa55655991805722a273064f0dad372c1d9cd4e073e436c9de1d41d7774e3737cbb50dd0
7
+ data.tar.gz: 7f0fe61d86c0d23a3f8c9c1888585b97a46f4494197121be2d0411e9476a3ccd398f53bc3d7b2bd45cba5bf44ce4596e0ac96b7662e08ea636042d7972d71f32
data/CHANGES.md CHANGED
@@ -1,6 +1,14 @@
1
1
  stormpath-sdk-ruby Changelog
2
2
  ============================
3
3
 
4
+ Version 1.2.1
5
+ -------------
6
+
7
+ Released on November 02, 2016
8
+
9
+ - Fix bug with passing store options to cache store
10
+
11
+
4
12
  Version 1.2.0
5
13
  -------------
6
14
 
@@ -3,14 +3,17 @@ require 'memcached'
3
3
  module Stormpath
4
4
  module Cache
5
5
  class MemcachedStore
6
+ DEFAULT_SERVER_HOST = 'localhost:11211'.freeze
7
+ attr_reader :memcached, :options
8
+
6
9
  def initialize(opts = {})
7
- options = nil if opts.blank?
8
- @memcached = Memcached.new(options)
10
+ @options = opts.blank? ? { host: DEFAULT_SERVER_HOST } : opts
11
+ @memcached = Memcached.new(options[:host], options_without_host)
9
12
  end
10
13
 
11
14
  def get(key)
12
15
  begin
13
- entry = @memcached.get(key)
16
+ entry = memcached.get(key)
14
17
  entry && Stormpath::Cache::CacheEntry.from_h(MultiJson.load(entry))
15
18
  rescue Memcached::NotFound
16
19
  nil
@@ -18,19 +21,23 @@ module Stormpath
18
21
  end
19
22
 
20
23
  def put(key, entry)
21
- @memcached.set(key, MultiJson.dump(entry.to_h))
24
+ memcached.set(key, MultiJson.dump(entry.to_h))
22
25
  end
23
26
 
24
27
  def delete(key)
25
- @memcached.delete(key)
28
+ memcached.delete(key)
26
29
  end
27
30
 
28
31
  def clear
29
- @memcached.flush
32
+ memcached.flush
30
33
  end
31
34
 
32
35
  def size
33
- @memcached.stats[:curr_items]
36
+ memcached.stats[:curr_items]
37
+ end
38
+
39
+ def options_without_host
40
+ options.tap { |hs| hs.delete(:host) }
34
41
  end
35
42
  end
36
43
  end
@@ -42,6 +42,7 @@ class Stormpath::DataStore
42
42
  CACHE_REGIONS.each do |region|
43
43
  region_opts = regions_opts[region.to_sym] || {}
44
44
  region_opts[:store] ||= cache_opts[:store]
45
+ region_opts[:store_opts] ||= cache_opts[:store_opts]
45
46
  @cache_manager.create_cache region, region_opts
46
47
  end
47
48
  end
@@ -14,6 +14,6 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module Stormpath
17
- VERSION = '1.2.0'
18
- VERSION_DATE = '2016-10-27'
17
+ VERSION = '1.2.1'
18
+ VERSION_DATE = '2016-11-02'
19
19
  end
@@ -4,7 +4,7 @@ shared_examples 'a data store' do
4
4
  let(:factory) { Stormpath::Test::ResourceFactory.new }
5
5
  let(:request_executor) { Stormpath::Test::TestRequestExecutor.new }
6
6
  let(:data_store) do
7
- Stormpath::DataStore.new(request_executor, test_api_key, { store: store }, nil)
7
+ Stormpath::DataStore.new(request_executor, test_api_key, store, nil)
8
8
  end
9
9
  let(:application_cache) { data_store.cache_manager.get_cache 'applications' }
10
10
  let(:tenant_cache) { data_store.cache_manager.get_cache 'tenants' }
@@ -182,12 +182,12 @@ end
182
182
 
183
183
  describe Stormpath::DataStore do
184
184
  context 'redis store' do
185
- let(:store) { Stormpath::Cache::RedisStore }
185
+ let(:store) { { store: Stormpath::Cache::RedisStore, store_opts: { read_timeout: 6.0 } } }
186
186
  it_should_behave_like 'a data store'
187
187
  end
188
188
 
189
189
  context 'memcached store' do
190
- let(:store) { Stormpath::Cache::MemcachedStore }
190
+ let(:store) { { store: Stormpath::Cache::MemcachedStore, store_opts: { host: 'localhost:11211', prefix_key: 'mem' } } }
191
191
  it_should_behave_like 'a data store'
192
192
  end
193
193
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stormpath-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stormpath, Inc
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-27 00:00:00.000000000 Z
12
+ date: 2016-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json