pause 0.1.1 → 0.1.2

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: 933cd48976e47aea715ac1f0f3bd22da4344a063
4
- data.tar.gz: fd9c429b618f120c41aecfbb950c7abe64884d8a
3
+ metadata.gz: f681f5880476f055a00a8131eb6977aad96a0ba5
4
+ data.tar.gz: 282371534a8dcdb32dac098f479ee5df62433e85
5
5
  SHA512:
6
- metadata.gz: 4f917cb743d4b3b788660a5dfd9ae1c46bc7ec7b5ae0ccfc29842ee0b1d387798801257dfd1897cb0955fb11f39f3fd3730104d97ba98d561be21ec79b3a7b74
7
- data.tar.gz: 4b033db609398e30b39fe7ac158b1c3e71f17723904f64652e339a648c58b83ea0626308dd232334e3b172758c8a806b864557a796717cdc10245483f4029b45
6
+ metadata.gz: f9eb4591aa2533a7ea2759e7cb9c929de36ff32b75160701edc436d7ca12ca05dd91f6c72e9b09a4d5b9dfb3a3fcc234a9edd00860b6a6f2d3f60ff1c321ff0c
7
+ data.tar.gz: 397807c6f15cd909985b943f3b4b616484c9934025ed27124bed1f76728e0a7ab7e6721dd226135c56352b6b640786be6130210a0f34592d521c5bdf14a33023
@@ -7,6 +7,19 @@ module Pause
7
7
  # Operations that are not possible when data is sharded
8
8
  # raise an error.
9
9
  class ShardedAdapter < Adapter
10
+ def increment(scope, identifier, timestamp, count = 1)
11
+ k = tracked_key(scope, identifier)
12
+ redis.zincrby k, count, period_marker(resolution, timestamp)
13
+ redis.expire k, history
14
+
15
+ if redis.zcard(k) > time_blocks_to_keep
16
+ list = extract_set_elements(k)
17
+ to_remove = list.slice(0, (list.size - time_blocks_to_keep))
18
+ redis.zrem(k, to_remove.map(&:ts))
19
+ end
20
+ end
21
+
22
+
10
23
  private
11
24
 
12
25
  def redis
@@ -1,3 +1,3 @@
1
1
  module Pause
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pause
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Atasay Gokkaya