mondrian_redis_segment_cache 0.4.0-java → 0.4.1-java
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c120ed66894ca27037fa5ab85ecd56fd9c57dbd0
|
4
|
+
data.tar.gz: 33fd9bcd2484e75540746890522b771d4e59666c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7bb09883b38bbe9ecfa321efe3e1eaf41cab8e7b0fbdb71a2b041fed15a1d557a52e7d1eea7391201bf686609c5f850ea7e88d930162206acff19f4779a8e6b
|
7
|
+
data.tar.gz: 4128c1f68b480e8b25c83ccbaab47fbec40cf1500a8af407e9874c7c7fc30dbda66e55d7649e176573343a4356169b8c3f020232de5db7977de6865b5bd1e28d
|
@@ -20,8 +20,8 @@ module MondrianRedisSegmentCache
|
|
20
20
|
def initialize(mondrian_redis_connection, new_options = {})
|
21
21
|
@mondrian_redis = mondrian_redis_connection
|
22
22
|
@options = Marshal.load(Marshal.dump(new_options))
|
23
|
-
@listeners =
|
24
|
-
@local_cache_set =
|
23
|
+
@listeners = ::Concurrent::Array.new
|
24
|
+
@local_cache_set = ::Concurrent::Array.new
|
25
25
|
|
26
26
|
##
|
27
27
|
# Having a TimerTask reconcile every 5 minutes so the local listeners are eventually consistent with
|
@@ -39,7 +39,8 @@ module MondrianRedisSegmentCache
|
|
39
39
|
# Public Instance Methods
|
40
40
|
#
|
41
41
|
def addListener(segment_cache_listener)
|
42
|
-
listeners << segment_cache_listener
|
42
|
+
listeners << segment_cache_listener unless listeners.include?(segment_cache_listener)
|
43
|
+
listeners.uniq!
|
43
44
|
end
|
44
45
|
|
45
46
|
# returns mondrian.spi.SegmentBody
|
@@ -78,7 +79,7 @@ module MondrianRedisSegmentCache
|
|
78
79
|
segment_header.getDescription # Hazel adapter says this affects serialization
|
79
80
|
header_base64 = segment_header_to_base64(segment_header)
|
80
81
|
body_base64 = segment_body_to_base64(segment_body)
|
81
|
-
@local_cache_set << header_base64
|
82
|
+
@local_cache_set << header_base64 unless @local_cache_set.include?(header_base64)
|
82
83
|
mondrian_redis.with do |connection|
|
83
84
|
connection.sadd(SEGMENT_HEADERS_SET_KEY, header_base64)
|
84
85
|
end
|
@@ -93,7 +94,6 @@ module MondrianRedisSegmentCache
|
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
96
|
-
publish_created_to_listeners(header_base64)
|
97
97
|
return ("#{set_success}".upcase == "OK" || set_success == true) # weird polymorphic return ?
|
98
98
|
end
|
99
99
|
|
@@ -113,7 +113,6 @@ module MondrianRedisSegmentCache
|
|
113
113
|
connection.del(header_base64)
|
114
114
|
end
|
115
115
|
|
116
|
-
publish_deleted_to_listeners(header_base64)
|
117
116
|
return deleted_keys >= 1
|
118
117
|
end
|
119
118
|
|
@@ -189,7 +188,7 @@ module MondrianRedisSegmentCache
|
|
189
188
|
end
|
190
189
|
|
191
190
|
def reconcile_local_set_with_redis
|
192
|
-
remote_set =
|
191
|
+
remote_set = []
|
193
192
|
|
194
193
|
mondrian_redis.with do |connection|
|
195
194
|
connection.sscan_each(SEGMENT_HEADERS_SET_KEY) do |segment_header_base64|
|
@@ -197,8 +196,10 @@ module MondrianRedisSegmentCache
|
|
197
196
|
end
|
198
197
|
end
|
199
198
|
|
200
|
-
|
201
|
-
|
199
|
+
local_copy = []
|
200
|
+
local_cache_set.each { |value| local_copy << value }
|
201
|
+
remote_added_keys = remote_set - local_copy
|
202
|
+
remote_removed_keys = local_copy - remote_set
|
202
203
|
|
203
204
|
remote_added_keys.each do |remote_added_key|
|
204
205
|
@local_cache_set << remote_added_key
|
@@ -209,6 +210,8 @@ module MondrianRedisSegmentCache
|
|
209
210
|
@local_cache_set.delete(remote_removed_key)
|
210
211
|
publish_deleted_to_listeners(remote_removed_key)
|
211
212
|
end
|
213
|
+
|
214
|
+
@local_cache_set.uniq!
|
212
215
|
end
|
213
216
|
|
214
217
|
def reconcile_set_and_keys
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mondrian_redis_segment_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Brandon Dewitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|