diff options
Diffstat (limited to 'lib/utils.coffee')
| -rw-r--r-- | lib/utils.coffee | 13 | 
1 files changed, 7 insertions, 6 deletions
| diff --git a/lib/utils.coffee b/lib/utils.coffee index 93045f32..de335452 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -323,14 +323,15 @@ class SimpleCache        null    rotate: (force = false) -> -    if force or @entries < Object.keys(@cache).length or @expiry < new Date() - @lastRotation -      @lastRotation = new Date() -      @previous = @cache -      @cache = {} +    Utils.nextTick => +      if force or @entries < Object.keys(@cache).length or @expiry < new Date() - @lastRotation +        @lastRotation = new Date() +        @previous = @cache +        @cache = {}    clear: -> -    @rotate true -    @rotate true +    @cache = {} +    @previous = {}  # This is a simple class for the common case where we want to use some data value which may be immediately  # available, or for which we may have to wait.  It implements a use-immediately-or-wait queue, and calls the | 
