snappy_stats 0.0.4 → 0.0.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.
@@ -81,7 +81,7 @@ def recordHit( time, key )
81
81
  end
82
82
  end
83
83
 
84
- def get(gran, from, to, key)
84
+ def get(gran, from, to, key)
85
85
  granularity = GRANULARITIES[gran]
86
86
  size = granularity[:size]
87
87
  factor = granularity[:factor]
@@ -92,10 +92,16 @@ def get(gran, from, to, key)
92
92
  ts = from
93
93
  i = 0
94
94
  results = {}
95
+ current_key = ""
96
+ data = nil
95
97
  while ts <= to
96
98
  tsround = getRoundedTimestamp( ts, size * factor )
97
99
  redis_key = "#{hash_key}:#{key}:#{gran}:#{tsround}"
98
- results[ts] = connection.hget( redis_key, ts )
100
+ if(current_key != redis_key)
101
+ data = connection.hgetall( redis_key )
102
+ current_key = redis_key
103
+ end
104
+ results[ts] = data[ ts.to_s ]
99
105
  i = i+1
100
106
  ts = ts + GRANULARITIES[gran][:factor]
101
107
  end
@@ -1,3 +1,3 @@
1
1
  class SnappyStats
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snappy_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-28 00:00:00.000000000 Z
12
+ date: 2013-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport