timed-rediscounter 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/timed/rediscounter.rb +2 -2
- data/lib/timed/rediscounter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a4af566d48f811a48e4306f28ac744080b9148d
|
4
|
+
data.tar.gz: 7fb4fe993b27202672743c47e342a9546228db48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/timed/rediscounter.rb
CHANGED
@@ -74,8 +74,8 @@ module Timed
|
|
74
74
|
|
75
75
|
def initialize(key,default_options={})
|
76
76
|
@key = key
|
77
|
-
@periods =
|
78
|
-
@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)
|
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.
|
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-
|
11
|
+
date: 2017-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|