mondrian_redis_segment_cache 0.1.0-java → 0.1.1-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9e9a5dcb5f41dc0fcd9f266b7ae722f5af59ff5
4
- data.tar.gz: 05b37206b7f4afa4c88b5c8be5ca2576ecc9e09d
3
+ metadata.gz: 3b62e31e45c942bb6005ee4fdd6b15c55f11374f
4
+ data.tar.gz: bb0ef55a4e73c6ad13f73a0aaf2d8350f573132f
5
5
  SHA512:
6
- metadata.gz: 8d1be0868c7639e726319593fc1b17ce5c5c94e52bc337f94d2da5a31e71079634156984d6acf5638b78afa9de8521d6feefef9bf0f1eb006bdcf0c3a8bcd2ea
7
- data.tar.gz: 67dd4b16b15c77a0882706123184a35f8e2b3bbfb21ad616c1d1197c99a52556081a515e3e0dba08a0a4d2f423ec359f3ff3d3fdc855a939a9f3c5e5d3f54c12
6
+ metadata.gz: 5ba18069f409a17f43d7f19d514534b89205af1ac5c68fe5dffc58687079805a047e8d4d0ca4dfc1cfe4d66beb82212f0d41f448383c8c32236c0b619bff0e0f
7
+ data.tar.gz: fc48d6c75ec2c253aca7aa4ba39428858fef4dd08afee56c6a2c9f290b1a5d7b8e0012b4fff7b2a59b2ca5ab4d04a9a0d775aec05b54067d22f2e6e38b4b9e97
@@ -6,11 +6,11 @@ module MondrianRedisSegmentCache
6
6
  class Cache
7
7
  include Java::MondrianSpi::SegmentCache
8
8
 
9
- attr_reader :created_listener_connection,
9
+ attr_reader :created_listener_connection,
10
10
  :deleted_listener_connection,
11
11
  :evicted_listener_connection,
12
12
  :expired_listener_connection,
13
- :listeners,
13
+ :listeners,
14
14
  :mondrian_redis,
15
15
  :options
16
16
 
@@ -28,7 +28,7 @@ module MondrianRedisSegmentCache
28
28
  @options = Marshal.load(Marshal.dump(new_options))
29
29
 
30
30
  reset_listeners
31
- register_for_redis_events
31
+ start
32
32
  reconcile_set_and_keys
33
33
  end
34
34
 
@@ -146,7 +146,7 @@ module MondrianRedisSegmentCache
146
146
  header_base64 = segment_header_to_base64(segment_header)
147
147
  body_base64 = segment_body_to_base64(segment_body)
148
148
  mondrian_redis.sadd(SEGMENT_HEADERS_SET_KEY, header_base64)
149
-
149
+
150
150
  if has_expiry?
151
151
  set_success = mondrian_redis.setex(header_base64, expires_in_seconds, body_base64)
152
152
  else
@@ -173,6 +173,15 @@ module MondrianRedisSegmentCache
173
173
  @listeners = Set.new
174
174
  end
175
175
 
176
+ def shutdown!
177
+ # Ouch, why so harsh?
178
+ @redis_events_threads.map(&:kill)
179
+ end
180
+
181
+ def start
182
+ register_for_redis_events
183
+ end
184
+
176
185
  def supportsRichIndex()
177
186
  true # this is why we are serializing the headers to base64
178
187
  end
@@ -237,8 +246,9 @@ module MondrianRedisSegmentCache
237
246
 
238
247
  # Not the best multi-threaded code, but its something that "works" for now and we will
239
248
  # worry about "best" later
249
+ @redis_events_threads = []
240
250
 
241
- Thread.new(created_listener_connection, self) do |created_redis_connection, mondrian_cache|
251
+ @redis_events_threads << Thread.new(created_listener_connection, self) do |created_redis_connection, mondrian_cache|
242
252
  created_redis_connection.subscribe(mondrian_cache.created_event_key) do |on|
243
253
  on.message do |channel, message|
244
254
  mondrian_cache.publish_created_to_listeners(message)
@@ -246,7 +256,7 @@ module MondrianRedisSegmentCache
246
256
  end
247
257
  end
248
258
 
249
- Thread.new(deleted_listener_connection, self) do |deleted_redis_connection, mondrian_cache|
259
+ @redis_events_threads << Thread.new(deleted_listener_connection, self) do |deleted_redis_connection, mondrian_cache|
250
260
  deleted_redis_connection.subscribe(mondrian_cache.deleted_event_key) do |on|
251
261
  on.message do |channel, message|
252
262
  mondrian_cache.publish_deleted_to_listeners(message)
@@ -254,7 +264,7 @@ module MondrianRedisSegmentCache
254
264
  end
255
265
  end
256
266
 
257
- Thread.new(expired_listener_connection, self) do |expired_redis_connection, mondrian_cache|
267
+ @redis_events_threads << Thread.new(expired_listener_connection, self) do |expired_redis_connection, mondrian_cache|
258
268
  expired_redis_connection.subscribe(mondrian_cache.expired_event_key) do |on|
259
269
  on.message do |channel, message|
260
270
  mondrian_cache.publish_expired_to_listeners(message)
@@ -262,7 +272,7 @@ module MondrianRedisSegmentCache
262
272
  end
263
273
  end
264
274
 
265
- Thread.new(evicted_listener_connection, self) do |evicted_redis_connection, mondrian_cache|
275
+ @redis_events_threads << Thread.new(evicted_listener_connection, self) do |evicted_redis_connection, mondrian_cache|
266
276
  evicted_redis_connection.subscribe(mondrian_cache.evicted_event_key) do |on|
267
277
  on.message do |channel, message|
268
278
  mondrian_cache.publish_evicted_to_listeners(message)
@@ -1,3 +1,3 @@
1
1
  module MondrianRedisSegmentCache
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.1.0
4
+ version: 0.1.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: 2014-07-02 00:00:00.000000000 Z
11
+ date: 2015-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis