mondrian_redis_segment_cache 0.0.7-java → 0.0.8-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: c755df929de96f518e93dadbecc397522e4d2687
4
- data.tar.gz: c7cd26eff9ff6f0c249a976388ca7a23a5675a22
3
+ metadata.gz: 52fc884f08cb6511123868a3d379072014b951ca
4
+ data.tar.gz: f41e83e0fcb83d3eea5093c3ee1ff3914fe4db76
5
5
  SHA512:
6
- metadata.gz: d540eec5a7f2f3377e7ddb2979ae0629eb4446ca83565fe4b801adfc9487223ea591256fae5344cf89848556842d667079687aefccb1d463401612f912a69735
7
- data.tar.gz: 15d18b921993f028252f6a9db33d25e16e1133ea0cd9a3019c0bb4af70dc56699eecd5541c8a7e423d590191b2a90c952b192c64c4f205eb8b529fee6c1a9a36
6
+ metadata.gz: d4184cbb636e36387a05137b443c5e9881fba0ebd727405b6fe566b1dc861de1167bd2816621d736e9334f4690428fa5797fbb54d10cde98ada5bfa5813b1f57
7
+ data.tar.gz: ec614f690401554c0df63f95b0b5fc05825ade5dd1fd5281f718f03c99bb44616e7c7d261c1cf6ad91633d2138eb68756978ed90fe76945e58161774209d06c9
data/README.md CHANGED
@@ -51,7 +51,7 @@ In Redis we use the notifications api, so you must turn it on!
51
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
52
  that must be turned on for this gem to work.
53
53
 
54
- `notify-keyspace-events Eg$`
54
+ `notify-keyspace-events Egex$`
55
55
 
56
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
57
  (like DEL, EXPIRE) and finally String commands (like SET)
@@ -50,7 +50,15 @@ module MondrianRedisSegmentCache
50
50
  end
51
51
 
52
52
  def deleted_event_key
53
- @created_event_key ||= "__keyevent@#{client_options[:db]}__:del"
53
+ @deleted_event_key ||= "__keyevent@#{client_options[:db]}__:del"
54
+ end
55
+
56
+ def evicted_event_key
57
+ @evicted_event_key ||= "__keyevent@#{client_options[:db]}__:evicted"
58
+ end
59
+
60
+ def expired_event_key
61
+ @expired_event_key ||= "__keyevent@#{client_options[:db]}__:expired"
54
62
  end
55
63
 
56
64
  def eager_load_listener(listener)
@@ -122,6 +130,8 @@ module MondrianRedisSegmentCache
122
130
  mondrian_redis.srem(SEGMENT_HEADERS_SET_KEY, message)
123
131
  end
124
132
  end
133
+ alias_method :publish_evicted_to_listeners, :publish_deleted_to_listeners
134
+ alias_method :publish_expired_to_listeners, :publish_deleted_to_listeners
125
135
 
126
136
  def put(segment_header, segment_body)
127
137
  segment_header.description # Hazel adapter says this affects serialization
@@ -219,6 +229,22 @@ module MondrianRedisSegmentCache
219
229
  end
220
230
  end
221
231
 
232
+ Thread.new(expired_listener_connection, self) do |expired_redis_connection, mondrian_cache|
233
+ expired_redis_connection.subscribe(mondrian_cache.expired_event_key) do |on|
234
+ on.message do |channel, message|
235
+ mondrian_cache.publish_expired_to_listeners(message)
236
+ end
237
+ end
238
+ end
239
+
240
+ Thread.new(evicted_listener_connection, self) do |evicted_redis_connection, mondrian_cache|
241
+ evicted_redis_connection.subscribe(mondrian_cache.evicted_event_key) do |on|
242
+ on.message do |channel, message|
243
+ mondrian_cache.publish_evicted_to_listeners(message)
244
+ end
245
+ end
246
+ end
247
+
222
248
  @listeners_registered = true
223
249
  end
224
250
 
@@ -1,3 +1,3 @@
1
1
  module MondrianRedisSegmentCache
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
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.7
4
+ version: 0.0.8
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-27 00:00:00.000000000 Z
11
+ date: 2014-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis