progressrus 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7742b5cfd79039be1c56599ef54db97ff88c65ca
4
- data.tar.gz: 6dc36accb4003983466de0d90a9a34abb1a567ea
3
+ metadata.gz: 7a78b4e02d15a9e3314128bf5e8a3d5a4e8cc3e1
4
+ data.tar.gz: dcb6e66cdf32a3ffb40aedafcc8057f8be22b276
5
5
  SHA512:
6
- metadata.gz: 232a6041d91f72852c02ff376a0a08681b31ec583a00baeeac5e1be8c7296a88f22fb741d51996a11877607dcd0f9674ba6179802b552f1b7932d5c77e1617e8
7
- data.tar.gz: 36ddb938cd4ccb27522082e0c5f397ceac5edce0f960a7c056fc82b2386aa187599621cf55dcc1f9dea52e5e0f70ae09ab20bc5c16bb6eba0842e241950f43ca
6
+ metadata.gz: b175333d4fef5fc9265a93974b644c86dc8e4072ff13d9cee3c312ce4fe0364b32c51352cac46fdcd8a11a172bdbbb14747757a7f813390af1cb9f5fcf325829
7
+ data.tar.gz: d550e3cfa6e85d0bec160e1c8c04fa5fc6c9c539659cc693368f630e569c097da2541eb7ade713c6fa1faeb3ded495b3ce0d7e569371c8f5684458337e3698db
@@ -13,9 +13,15 @@ class Progressrus
13
13
  @prefix = prefix
14
14
  end
15
15
 
16
- def persist(progress, now: Time.now, force: false)
16
+ def persist(progress, now: Time.now, force: false, expires_at: nil)
17
17
  if outdated?(progress) || force
18
- redis.hset(key(progress.scope), progress.id, progress.to_serializeable.to_json)
18
+ key_for_scope = key(progress.scope)
19
+
20
+ redis.pipelined do
21
+ redis.hset(key_for_scope, progress.id, progress.to_serializeable.to_json)
22
+ redis.expireat(key_for_scope, expires_at) if expires_at
23
+ end
24
+
19
25
  @persisted_ats[progress.scope][progress.id] = now
20
26
  end
21
27
  rescue *BACKEND_EXCEPTIONS => e
@@ -1,3 +1,3 @@
1
1
  class Progressrus
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/progressrus.rb CHANGED
@@ -153,7 +153,7 @@ class Progressrus
153
153
  def persist(force: false)
154
154
  stores.each do |store|
155
155
  begin
156
- store.persist(self, force: force)
156
+ store.persist(self, force: force, expires_at: expires_at)
157
157
  rescue Progressrus::Store::BackendError => e
158
158
  end
159
159
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: progressrus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Eskildsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-13 00:00:00.000000000 Z
11
+ date: 2015-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis