redis-set 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/redis_set.rb +7 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45e696c793b4e362dcac1b1256ca2581f2346230
|
4
|
+
data.tar.gz: aca48ae696bba8947b94f612431a1f5aa20e96e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d66c98309c636ee604bf8e288a7e2c85f6bde73f76bfd0ab1a27de1fbe57a358b1bcde336bfee7baeda03c75ed01ea02c02a3cbdc7fc7757f4c1bc54c2483175
|
7
|
+
data.tar.gz: c8a7375bd5a71de527013e606f688e97ecfd2237b0ee3a6ccb6ba6685fd931123d12871ff08bd6b99748468b141806c545c7dd2494274b36494b204aff69c9ee
|
data/lib/redis_set.rb
CHANGED
@@ -3,12 +3,12 @@ require "redis"
|
|
3
3
|
class RedisSet
|
4
4
|
attr_reader :name
|
5
5
|
|
6
|
-
VERSION = "0.0.
|
6
|
+
VERSION = "0.0.4"
|
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
|
@@ -26,6 +26,10 @@ class RedisSet
|
|
26
26
|
else
|
27
27
|
raise InvalidRedisConfigException.new
|
28
28
|
end
|
29
|
+
|
30
|
+
if more_options.kind_of?(Hash) && more_options[:expire]
|
31
|
+
@redis.expire more_options[:expire]
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
def add *values
|
@@ -102,7 +106,7 @@ class RedisSet
|
|
102
106
|
alias flush clear
|
103
107
|
|
104
108
|
def expire seconds
|
105
|
-
with{|redis| redis.expire name, seconds}
|
109
|
+
with{|redis| redis.expire name, seconds.to_i}
|
106
110
|
end
|
107
111
|
|
108
112
|
private
|