redtastic 0.3.4 → 0.3.5

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: 760a4755853fbe582ee3ed320662ae66d9321988
4
- data.tar.gz: 119370f58d4aa68ba8c0baecf7d78a5c135ae76a
3
+ metadata.gz: d22d6b764b12ed7179b1bf360c07ddb419c5db33
4
+ data.tar.gz: 60e2fe42a6f0b59d48e03f4529dd9e1b0272bfd1
5
5
  SHA512:
6
- metadata.gz: a80be7139570cb50051e678a8f23244676267b3b010e0113cdb7cbe8ba8a7930300e8916f8804b9bef4726b928d14eb4b9d4fda7f742ca04305f275bcc505d2b
7
- data.tar.gz: 87f7e433c24c1ef6e37558fa0bfefe4a9d99bf9b521ea06eb7e3cf46181707319602d11e504b731793b36db976653a43237142c9e2d39b7be5024af06c97d7a0
6
+ metadata.gz: 85777001fe9b413002cb27870238f574f929e7c808e457844fba14d6618595065a7e5b1ef1592f54ce1bfe70e36944f51397a84f3fd48495e685b4b914c49263
7
+ data.tar.gz: 636b9dc0a0f95b8c90f9266b9efafbb8161d3e6e6f437e4addd2821c29997466dc9992b9fdb13a9337a6cd7d92ba175b964fc6f76267aff274a0b7d73b13781f
@@ -1,6 +1,9 @@
1
1
  master
2
2
  ======
3
- * Added a CHANGELOG
3
+
4
+ 0.3.5
5
+ =====
6
+ * [Added hmsum Lua script that uses Redis hmget](https://github.com/bellycard/redtastic/pull/40)
4
7
 
5
8
  0.3.4
6
9
  =====
@@ -9,3 +12,4 @@ master
9
12
  0.3.3
10
13
  =====
11
14
  * [Fix for dates on weekly metrics](https://github.com/bellycard/redtastic/pull/37)
15
+ * Added a CHANGELOG
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- redtastic (0.3.4)
4
+ redtastic (0.3.5)
5
5
  activesupport
6
6
  redis
7
7
 
@@ -0,0 +1,31 @@
1
+ -- Returns the total sum of the values for each key in KEYS, across multiple ids in ARGV
2
+ -- KEYS: [ "key1", "key2" ]
3
+ -- ARGV: [1, 2, 3]
4
+
5
+ -- Example data structures
6
+ -- hkeys key1
7
+ -- => "1" => "1", "2" => "4"
8
+ -- hkeys key2
9
+ -- => "2" => "3", "3" => "5"
10
+ -- hmget key1 1 2 3
11
+ -- => ["1", "4", nil]
12
+ -- hmget key2 1 2 3
13
+ -- => [nil, "3", "5"]
14
+
15
+ -- This script will evaluate the above data structure and sum the result of the array values
16
+ -- that match the ids in ARGV. i.e. The example above will return 5 + 8 = 13
17
+
18
+ local sum = 0
19
+
20
+ for i=1,#KEYS do
21
+ local value_array = redis.call('HMGET', KEYS[i], unpack(ARGV))
22
+
23
+ for j=1,#value_array do
24
+ local elem = value_array[j]
25
+ if elem then
26
+ sum = sum + tonumber(elem)
27
+ end
28
+ end
29
+ end
30
+
31
+ return sum
@@ -1,3 +1,3 @@
1
1
  module Redtastic
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe DiVita
@@ -158,6 +158,7 @@ files:
158
158
  - lib/redtastic/scripts/data_points_for_keys.lua
159
159
  - lib/redtastic/scripts/hmfind.lua
160
160
  - lib/redtastic/scripts/hmincrby.lua
161
+ - lib/redtastic/scripts/hmsum.lua
161
162
  - lib/redtastic/scripts/msadd.lua
162
163
  - lib/redtastic/scripts/msismember.lua
163
164
  - lib/redtastic/scripts/msrem.lua