allora 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  ### head
2
2
 
3
+ ### 0.1.10
4
+
5
+ * Redis backend store can specify a TTL [iamliamnorton]
6
+
3
7
  ### 0.1.9
4
8
 
5
9
  * New redis backend instances call `#reset!` conditionally [iamliamnorton]
@@ -33,6 +33,7 @@ module Allora
33
33
  class Backend::Redis < Backend
34
34
  attr_reader :redis
35
35
  attr_reader :prefix
36
+ attr_reader :ttl
36
37
 
37
38
  # Initialize the Redis backed with the given options.
38
39
  #
@@ -41,13 +42,15 @@ module Allora
41
42
  # host: the hostname of a Redis server
42
43
  # port: the port number of a Redis server
43
44
  # prefix: a namespace prefix to use
44
- # reset: delete existing job timing keys in Redis
45
+ # reset: delete existing job timing entries in Redis
46
+ # ttl: ttl for job timing entries in Redis
45
47
  #
46
48
  # @param [Hash] opts
47
49
  # options for the Redis backend
48
50
  def initialize(opts = {})
49
51
  @redis = create_redis(opts)
50
52
  @prefix = opts.fetch(:prefix, "allora")
53
+ @ttl = Integer opts.fetch(:ttl, 0)
51
54
 
52
55
  reset! if opts.fetch(:reset, true)
53
56
  end
@@ -89,6 +92,7 @@ module Allora
89
92
  if run_at <= time
90
93
  redis.multi do
91
94
  redis.set(job_info_key(name), time_to_int(job.next_at(time)))
95
+ redis.expire(job_info_key(name), ttl) if ttl > 0
92
96
  end
93
97
  else
94
98
  redis.unwatch && false
@@ -22,5 +22,5 @@
22
22
  ##
23
23
 
24
24
  module Allora
25
- VERSION = "0.1.9"
25
+ VERSION = "0.1.10"
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allora
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-18 00:00:00.000000000 Z
12
+ date: 2016-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis