mondrian_redis_segment_cache 0.4.1-java → 0.4.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mondrian_redis_segment_cache/cache.rb +14 -10
- data/lib/mondrian_redis_segment_cache/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c5b0fc11676333a22bf8d22f1c4ab0df228cb88
|
4
|
+
data.tar.gz: 15b9f22447a307040ad73ac05d5e4deae2db36da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6e90f71c3d5e5331f4c20470bd556e53797103d28bd054bd3265f7d5ce2f87a31ac90e3f6e5e77fc4d3e474ed9e81238d3bbd7241f8df5e4154685f51df691d
|
7
|
+
data.tar.gz: 20e05ea1857664127c1889fd38360b37b648b8ccca84e318f0fca87ab09e3dbb281174d5a0047a102c6204dbe8162af0f1d0421d1e4976698c1f265a1e5fc561
|
@@ -1,9 +1,16 @@
|
|
1
1
|
require 'redis'
|
2
2
|
require 'concurrent'
|
3
|
+
require 'jruby/synchronized'
|
3
4
|
require 'mondrian_redis_segment_cache/created_event'
|
4
5
|
require 'mondrian_redis_segment_cache/deleted_event'
|
6
|
+
require 'set'
|
5
7
|
|
6
8
|
module MondrianRedisSegmentCache
|
9
|
+
|
10
|
+
class SynchronizedSet < ::Set
|
11
|
+
include ::JRuby::Synchronized
|
12
|
+
end
|
13
|
+
|
7
14
|
class Cache
|
8
15
|
include Java::MondrianSpi::SegmentCache
|
9
16
|
|
@@ -20,14 +27,14 @@ module MondrianRedisSegmentCache
|
|
20
27
|
def initialize(mondrian_redis_connection, new_options = {})
|
21
28
|
@mondrian_redis = mondrian_redis_connection
|
22
29
|
@options = Marshal.load(Marshal.dump(new_options))
|
23
|
-
@listeners =
|
24
|
-
@local_cache_set =
|
30
|
+
@listeners = SynchronizedSet.new
|
31
|
+
@local_cache_set = SynchronizedSet.new
|
25
32
|
|
26
33
|
##
|
27
|
-
# Having a TimerTask reconcile every
|
34
|
+
# Having a TimerTask reconcile every 6 minutes so the local listeners are eventually consistent with
|
28
35
|
# respect to what is in the cache and what has been done .... allows us to get rid of the event
|
29
|
-
# subscribers in the redis API ... consider the job to have timed out after
|
30
|
-
@reconcile_task = ::Concurrent::TimerTask.new(:execution_interval => 360, :timeout_interval =>
|
36
|
+
# subscribers in the redis API ... consider the job to have timed out after 60 seconds
|
37
|
+
@reconcile_task = ::Concurrent::TimerTask.new(:execution_interval => 360, :timeout_interval => 60) do
|
31
38
|
reload
|
32
39
|
end
|
33
40
|
|
@@ -39,8 +46,7 @@ module MondrianRedisSegmentCache
|
|
39
46
|
# Public Instance Methods
|
40
47
|
#
|
41
48
|
def addListener(segment_cache_listener)
|
42
|
-
listeners << segment_cache_listener
|
43
|
-
listeners.uniq!
|
49
|
+
listeners << segment_cache_listener
|
44
50
|
end
|
45
51
|
|
46
52
|
# returns mondrian.spi.SegmentBody
|
@@ -79,7 +85,7 @@ module MondrianRedisSegmentCache
|
|
79
85
|
segment_header.getDescription # Hazel adapter says this affects serialization
|
80
86
|
header_base64 = segment_header_to_base64(segment_header)
|
81
87
|
body_base64 = segment_body_to_base64(segment_body)
|
82
|
-
@local_cache_set << header_base64
|
88
|
+
@local_cache_set << header_base64
|
83
89
|
mondrian_redis.with do |connection|
|
84
90
|
connection.sadd(SEGMENT_HEADERS_SET_KEY, header_base64)
|
85
91
|
end
|
@@ -210,8 +216,6 @@ module MondrianRedisSegmentCache
|
|
210
216
|
@local_cache_set.delete(remote_removed_key)
|
211
217
|
publish_deleted_to_listeners(remote_removed_key)
|
212
218
|
end
|
213
|
-
|
214
|
-
@local_cache_set.uniq!
|
215
219
|
end
|
216
220
|
|
217
221
|
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.2
|
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-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|