From e02f6f374287ebf33478288c10835bb08e7a2e3a Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 29 Dec 2014 22:19:49 +0300 Subject: [PATCH] documented the .clearGuaranteedQueue(..) method... Signed-off-by: Alex A. Naanou --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 0dd52d1..7febbed 100644 --- a/README.md +++ b/README.md @@ -74,3 +74,24 @@ results.on('match', function(path){ console.log('found: '+path) }) ``` + +Cache cleaning and use for long running emitters +------------------------------------------------ + +This is not recommended for use in long running event emitters as each +event emitted data will get stored and might get quite large, i.e. a +potential source for a leak. + +To deal with this issue a `.clearGuaranteedQueue()` method is +added to the emitter, this will clear the cache for a specific event and +a shorthand form `.clearGuaranteedQueue('*')` that will clear the cache +for all wrapped events. + +So for the above example: +```javascript +// This this will drop all the prior matches, so newly registred handlers +// will not see them... +results.clearGuaranteedQueue('match') + +``` +