diff options
| author | Stephen Blott | 2015-05-08 11:31:05 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-05-08 11:31:05 +0100 | 
| commit | 44378220093ee5bd873b553f5be556921c778663 (patch) | |
| tree | e1a25809f3edb9975f0c47aad3a30f777e045604 /lib | |
| parent | 3e890adbbf7b6a9671b42536b6ee6221389b9443 (diff) | |
| download | vimium-44378220093ee5bd873b553f5be556921c778663.tar.bz2 | |
Search completion; clear (not replace) the cache.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils.coffee | 11 | 
1 files changed, 11 insertions, 0 deletions
| diff --git a/lib/utils.coffee b/lib/utils.coffee index 354d82f6..1c24a40f 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -236,6 +236,17 @@ class SimpleCache      else        null +  clear: -> +    @rotate() +    @rotate() + +  # Because of the timer, we can't just let these caches go out of scope and have the garbage collector +  # harvest them.  Whenever they may fall out of use, we need to remove the timer. @rotate() can be used to +  # restart the cache. +  suspend: -> +    clearTimeout @timer if @timer? +    @timer = null +    # Set value, and return that value.  If value is null, then delete key.    set: (key, value = null) ->      if value? | 
