timed-rediscounter 1.1.0 → 1.1.1

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: 3ab171bfcc29c9c01be174d50a66d73d5cd17c66
4
- data.tar.gz: 696ebb57d229433cdb0501d4bddcab570e25edfe
3
+ metadata.gz: 2a4af566d48f811a48e4306f28ac744080b9148d
4
+ data.tar.gz: 7fb4fe993b27202672743c47e342a9546228db48
5
5
  SHA512:
6
- metadata.gz: 53088c48c58c7244c5fa60b8460fe547ba91da289e33219ed377ae1d7a468320faf67d3e09b8c15bc25dac820a89eded9a0b74be29a432779d4316faa11cebbc
7
- data.tar.gz: c755cdf26a99c8c715826893e5631a91a043b6700d64d36dd7b528957ea5cf1d91fddb5cf5da1f8c8f9fad54737a96cbbfb7f47644ec751c654f2e6d3bdd8335
6
+ metadata.gz: 1ddd6196e72f7a3d521397bcc66ca9d1589c85c37433b1eaacc99bc469c26a7ffd5f6b1871e5c4abb4827f37319c51c932ce53ba8c4786df3c3125e09951628e
7
+ data.tar.gz: 241d5c125677c76a5f867c57a0404835f1ec64b951eaac2d6ef8ab72e0139fafb198ad4e1f811ea1cb2829f1887ef852c5e2aeb811a8f9e6283c2c08cb0cb434
data/README.md CHANGED
@@ -58,6 +58,11 @@ obj.test1.history(1.minute.ago)
58
58
  #optional with step as second argument.
59
59
  #normally the step will be calculated by given range
60
60
  obj.test1.history(1.year.ago,:minute)
61
+ #if you want to have a summed up history.
62
+ #For example if every incrementation was a was a change of a total value and
63
+ #you want to get the total amount at each point in time
64
+ #ATTENTION: it starts at 0 !
65
+ obj.test1.summed_up_history(1.year.ago)
61
66
 
62
67
 
63
68
  #returns the sum in the given range
@@ -71,6 +76,13 @@ obj.test1.sum(1.minute.ago..Time.now) #or obj.sum(1.minute.ago)
71
76
  ```ruby
72
77
  obj.test1.delete_keys
73
78
  obj.test1.expire_keys(10) #in seconds
79
+
80
+ #definig a standard expiry in Class
81
+ #standard is 2.years
82
+ timed_rediscounter(:test2,periods: [:hour,:day],expires_in: 1.month)
83
+ #if you want to disable the expiry then you have to pass false as argument
84
+ timed_rediscounter(:test2,periods: [:hour,:day],expires_in: false)
85
+
74
86
  ```
75
87
 
76
88
  ## Development
@@ -74,8 +74,8 @@ module Timed
74
74
 
75
75
  def initialize(key,default_options={})
76
76
  @key = key
77
- @periods = (default_options.delete(:periods) || Periods)
78
- @redis = (default_options.delete(:redis) || Timed::Rediscounter.redis)
77
+ @periods = default_options.fetch(:periods,Periods)
78
+ @redis = default_options.fetch(:redis,Timed::Rediscounter.redis)
79
79
  raise_if_not_valid_periods(@periods)
80
80
  @default_options = default_options.to_h
81
81
  @expires_in = @default_options.fetch(:expires_in, 2.year.to_i)
@@ -1,5 +1,5 @@
1
1
  module Timed
2
2
  module Rediscounter
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timed-rediscounter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Geduhn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-02 00:00:00.000000000 Z
11
+ date: 2017-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis