mondrian_redis_segment_cache 0.0.3-java → 0.0.4-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: 0b363ec2ebfcef465a41d81444cd42ab70c2029a
4
- data.tar.gz: fda2bebc4d9ae5db22cd53449b060269f0450617
3
+ metadata.gz: 5037596f5c1489481ba34ee7cdbdfefa8a5ae1b9
4
+ data.tar.gz: f5c3b7fd0c3d5f900d71274266f8c921cc2aca7d
5
5
  SHA512:
6
- metadata.gz: bd1974e2d202c94f60b3063d7a3556c884cc4dd52b45fd416cb47e6a8760a00110975723929df9603be739071cbc6421864b67d8224ec0059f1dde5bb5385db6
7
- data.tar.gz: ecb56df3250164aa5c2c324107e20eb4149c20341f69f51a90a0b63ec1bfbfa860fca856c27b21c9241040e320ce1c43666f28bf0d90fc8020ea67baafe442e8
6
+ metadata.gz: 63618da9eb4cf34f3863e3d77611c518e9abb16bf6d912256ed924dd9a247287b900ed9acb2f92f606abefbcaece3c30c243c1faa50dac22d0151aaefd7b4ca5
7
+ data.tar.gz: 9267d27e4b9897c1f5bd657b626da7edaeb53b48120b5f5f3e9f8424c491b2aced2ada7e42c469f8fe78fc982cfc51831795e2bc73e770d6adf29a0cb849c09e
data/README.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # MondrianRedisSegmentCache
2
2
 
3
- TODO: Write a gem description
3
+ Mondrian ships with an in memory segment cache that is great for standalone deployments of Mondrian, but doesn't
4
+ scale out with multiple nodes. An interface is provided for extending Mondrian with a shared Segment Cache and
5
+ examples of other implementations are in the links below.
6
+
7
+ In order to use Mondrian with Redis (our preferred caching layer) and Ruby (our preferred language -- Jruby) we had
8
+ to implement the SegmentCache interface from Mondrian and use the Redis notifications api.
9
+
10
+ Mondrian's segment cache needs to be able to get/set/remove cache items and also get any updates from the caching server
11
+ as other nodes are getting/setting/removing entries. This means that we need to use both the notifications and subscribe
12
+ api's from Redis.
13
+
14
+ http://stackoverflow.com/questions/17533594/implementing-a-mondrian-shared-segmentcache
15
+ http://mondrian.pentaho.com/api/mondrian/spi/SegmentCache.html
16
+ https://github.com/pentaho/mondrian/blob/master/src/main/mondrian/rolap/cache/MemorySegmentCache.java
17
+ https://github.com/webdetails/cdc
18
+ http://redis.io/topics/notifications
4
19
 
5
20
  ## Installation
6
21
 
@@ -18,7 +33,30 @@ Or install it yourself as:
18
33
 
19
34
  ## Usage
20
35
 
21
- TODO: Write usage instructions here
36
+ If using Rails you can put the configuration in an initializer
37
+
38
+ ```ruby
39
+ require 'redis'
40
+ require 'mondrian_redis_segment_cache'
41
+
42
+ # Setup a Redis connection
43
+ MONDRIAN_REDIS_CONNECTION = Redis.new(:url => "redis://localhost:1234/2")
44
+ MONDRIAN_SEGMENT_CACHE = ::MondrianRedisSegmentCache::Cache.new(MONDRIAN_REDIS_CONNECTION)
45
+
46
+ # Register the segment cache with the Mondrian Injector
47
+ ::Java::MondrianSpi::SegmentCache::SegmentCacheInjector::add_cache(MONDRIAN_SEGMENT_CACHE)
48
+ ```
49
+
50
+ In Redis we use the notifications api, so you must turn it on!
51
+ It is off by default because it is a new feature and can be CPU intensive. Redis does a ton, so there is a minimum of notifications
52
+ that must be turned on for this gem to work.
53
+
54
+ `notify-keyspace-events Eg$`
55
+
56
+ This tells Redis to publish keyevent events (which means we can subscribe to things like set/del) and to publish the generic commands
57
+ (like DEL, EXPIRE) and finally String commands (like SET)
58
+
59
+ The SegmentCache uses these notifications to keep Mondrian in sync across your Mondrian instances.
22
60
 
23
61
  ## Contributing
24
62
 
@@ -1,4 +1,6 @@
1
1
  require 'redis'
2
+ require 'mondrian_redis_segment_cache/created_event'
3
+ require 'mondrian_redis_segment_cache/deleted_event'
2
4
 
3
5
  module MondrianRedisSegmentCache
4
6
  class Cache
@@ -82,7 +84,7 @@ module MondrianRedisSegmentCache
82
84
 
83
85
  if segment_header
84
86
  listeners.each do |listener|
85
- created_event = MondrianRedisCacheCreatedEvent.new(segment_header)
87
+ created_event = ::MondrianRedisSegmentCache::CreatedEvent.new(segment_header)
86
88
  listener.handle(created_event)
87
89
  end
88
90
  end
@@ -93,8 +95,8 @@ module MondrianRedisSegmentCache
93
95
 
94
96
  if segment_header
95
97
  listeners.each do |listener|
96
- deleted_event = MondrianRedisCacheDeletedEvent.new(segment_header)
97
- listener.handle(deleted_evet)
98
+ deleted_event = ::MondrianRedisSegmentCache::DeletedEvent.new(segment_header)
99
+ listener.handle(deleted_event)
98
100
  end
99
101
  end
100
102
  end
@@ -1,3 +1,3 @@
1
1
  module MondrianRedisSegmentCache
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
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.0.3
4
+ version: 0.0.4
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-06-20 00:00:00.000000000 Z
11
+ date: 2014-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis