mshard 0.7.0 → 0.7.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
  SHA256:
3
- metadata.gz: 0ce179b6ef6576d2dc2fd36969467a4abe3cefdd370f8441abb79abc8b322099
4
- data.tar.gz: '0828489a9cd19625b367a8601794d6c8419ae4b1cb43d2390e13444f4701e1ef'
3
+ metadata.gz: 0a533debc16fe3c2f1dad4735b5bb6307b991c1a4bf79f7462112767566a21c9
4
+ data.tar.gz: 0f7c2af7de0c54fca819cb4da824508d5ce4f5aff94dd066cda03dbfc1f5efe4
5
5
  SHA512:
6
- metadata.gz: 2be0b0a7363f4ac4c70e37412f20a73e90d5c5d41e7092a4d1190c22b9cd6c57cbc17f8c0486f9d419edde0026c905917444f69590e692951e444c23be039faf
7
- data.tar.gz: 91c3f288a1a0d278ba63d9f8ab809a50a25e8ea6b46a337d6e94cf63e5d2656c9274f446a41726538a82552765833569ee26c8a9addda09452e19fc382fe1353
6
+ metadata.gz: d5e193fdc0c040a628c4cce3d63a64c6980a450380c40a5c2a6e5baf6d5a23c6c8107d11623f8eb64269d5dd28eb536d6854271a768fae773cbee4497b78cc3e
7
+ data.tar.gz: 9b6e2efd1dd81a7d815b7d31a371688358c46eca53db08ab7258aa22465836316f7e3c8e6cebb8dbe77528ea43ace605b46fabb2b466fecca35fd70d98063f99
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mshard (0.7.0)
4
+ mshard (0.7.1)
5
5
  hiredis
6
6
  httparty
7
7
  no_proxy_fix
@@ -41,7 +41,7 @@ GEM
41
41
  guard (~> 2.0)
42
42
  rubocop (~> 0.20)
43
43
  hiredis (0.6.1)
44
- httparty (0.16.0)
44
+ httparty (0.16.1)
45
45
  multi_xml (>= 0.5.2)
46
46
  json (2.1.0)
47
47
  listen (3.1.5)
@@ -51,16 +51,22 @@ module MShard
51
51
  Slack::Notifier.new(args[:webhook_url], **args).ping(args[:text])
52
52
  end
53
53
 
54
+ def self.redis_cache(uri)
55
+ @cache ||= Hash.new do |hash, uri_|
56
+ hash[uri_] = Redis::Namespace.new(:shard, redis: Redis.new(url: uri_))
57
+ end
58
+ @cache[uri]
59
+ end
60
+
54
61
  def load(id, redis_uri: ENV['MSHARD_REDIS_URI'])
55
62
  return get(id) if detour? || redis_uri.nil?
56
- redis = Redis::Namespace.new(:shard, redis: Redis.new(url: redis_uri))
57
- redis.get(id)
63
+ self.class.redis_cache(redis_uri).get(id)
58
64
  end
59
65
 
60
66
  def save(redis_uri: ENV['MSHARD_REDIS_URI'], **args)
61
67
  return set(**args) if detour? || redis_uri.nil?
62
- redis = Redis::Namespace.new(:shard, redis: Redis.new(url: redis_uri))
63
- response = redis.set(args[:id], args[:contents])
68
+ response =
69
+ self.class.redis_cache(redis_uri).set(args[:id], args[:contents])
64
70
  raise response unless response == 'OK'
65
71
  args[:id]
66
72
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MShard
4
- VERSION = '0.7.0'
4
+ VERSION = '0.7.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mshard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minwoo Lee