redtastic 0.3.4 → 0.3.5
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/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/lib/redtastic/scripts/hmsum.lua +31 -0
- data/lib/redtastic/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d22d6b764b12ed7179b1bf360c07ddb419c5db33
|
4
|
+
data.tar.gz: 60e2fe42a6f0b59d48e03f4529dd9e1b0272bfd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85777001fe9b413002cb27870238f574f929e7c808e457844fba14d6618595065a7e5b1ef1592f54ce1bfe70e36944f51397a84f3fd48495e685b4b914c49263
|
7
|
+
data.tar.gz: 636b9dc0a0f95b8c90f9266b9efafbb8161d3e6e6f437e4addd2821c29997466dc9992b9fdb13a9337a6cd7d92ba175b964fc6f76267aff274a0b7d73b13781f
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
master
|
2
2
|
======
|
3
|
-
|
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
|
data/Gemfile.lock
CHANGED
@@ -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
|
data/lib/redtastic/version.rb
CHANGED
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
|
+
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
|