Skip to content

Instantly share code, notes, and snippets.

@renan
Created October 2, 2012 09:33
Show Gist options
  • Save renan/3817803 to your computer and use it in GitHub Desktop.
Save renan/3817803 to your computer and use it in GitHub Desktop.
diff --git a/EventCacheInst.php b/EventCacheInst.php
index b0dcee9..6ef92b6 100644
--- a/EventCacheInst.php
+++ b/EventCacheInst.php
@@ -391,7 +391,13 @@ class EventCacheInst {
return $safeKeys[$type.','.$key];
}
- $safeKey = $this->_config['app'] .
+ // Use the trackEvents as namespace in case more than one application wants to share the same events
+ // So each app can still have their own keys, however all the events will be tracked on a global namespace
+ $namespace = (in_array($type, array('events', 'event')) && !empty($this->_config['trackEvents']) && is_string($this->_config['trackEvents']))
+ ? $this->_config['trackEvents']
+ : $this->_config['app'];
+
+ $safeKey = $namespace .
$this->_config['delimiter'] .
$type .
$this->_config['delimiter'] .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment