redis-hash 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/redis_hash.rb +9 -5
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85a8b1962255ec8f93b16d178f4e3c10cef67c28
4
- data.tar.gz: a8a13239647b7e360e0fff89013b2c3838338403
3
+ metadata.gz: fb0efcb0893f43a21cfc4f3de01007b68a3e020b
4
+ data.tar.gz: 04d74c8e49327e375f95ffdcc7469c82acfaf7bc
5
5
  SHA512:
6
- metadata.gz: 0d24c057dc13296b6146ef93c0b7565519278db20671f520f9391c5da470b447047d5bf830d4c114a11a2406d364aac5a8a7e7ad1e6f6a1855f1d842b7d506b0
7
- data.tar.gz: 6f53e0c9502c8e7f76cb3ff913435029d8c11a5c3123d648d3fb259fcd53ea804d9ed0ad83508779c79d02ad8871d939b0df35bcda34d5957e5dfcc0c5f3ed56
6
+ metadata.gz: 9b1985397afe956ef61fd016d6e815addecfae700e8a734655857494626ca040863d0a45476696e1c976929d9de828a7b3c17836984e07503f3dc2c9a444bc16
7
+ data.tar.gz: 4300ed544e9eca61f0800652dc958f4095f0e0a8e3447b4a741cdf952a95f1f10b4243526f939e591f57f1d3e0ce12c0cafd79fec5b14e1535dffbbaf6c6f224
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- redis-hash (0.0.2)
4
+ redis-hash (0.0.5)
5
5
  redis
6
6
 
7
7
  GEM
data/lib/redis_hash.rb CHANGED
@@ -3,12 +3,12 @@ require "redis"
3
3
  class RedisHash
4
4
  attr_reader :name
5
5
 
6
- VERSION = "0.0.4"
6
+ VERSION = "0.0.5"
7
7
 
8
8
  class InvalidNameException < StandardError; end;
9
9
  class InvalidRedisConfigException < StandardError; end;
10
10
 
11
- def initialize(name, redis_or_options = {})
11
+ def initialize(name, redis_or_options = {}, more_options = {})
12
12
  name = name.to_s if name.kind_of? Symbol
13
13
 
14
14
  raise InvalidNameException.new unless name.kind_of?(String) && name.size > 0
@@ -18,14 +18,18 @@ class RedisHash
18
18
  elsif redis_or_options.kind_of? Hash
19
19
  ::Redis.new redis_or_options
20
20
  elsif defined?(ActiveSupport::Cache::RedisStore) && redis_or_options.kind_of?(ActiveSupport::Cache::RedisStore)
21
- @pooled = redis_or_options.data.kind_of?(ConnectionPool)
21
+ @pooled = redis_or_options.data.kind_of?(ConnectionPool)
22
22
  redis_or_options.data
23
23
  elsif defined?(ConnectionPool) && redis_or_options.kind_of?(ConnectionPool)
24
- @pooled = true
25
- redis_or_options
24
+ @pooled = true
25
+ redis_or_options
26
26
  else
27
27
  raise InvalidRedisConfigException.new
28
28
  end
29
+
30
+ if more_options.kind_of?(Hash) && more_options[:expire]
31
+ expire more_options[:expire]
32
+ end
29
33
  end
30
34
 
31
35
  def get *keys
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Misha Conway
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-22 00:00:00.000000000 Z
11
+ date: 2019-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler