prerender-redis-cache icon indicating copy to clipboard operation
prerender-redis-cache copied to clipboard

Clear cache

Open dottodot opened this issue 10 years ago • 6 comments

Are you still going to be implementing a clear cache option for this?

dottodot avatar Jun 02 '15 14:06 dottodot

Hi @dottodot - I haven't had time to do it yet but would definitely like to do it sometime soon - it wouldn't take long to implement. Let me see if I can get to this at the weekend.

JonathanBennett avatar Jun 03 '15 05:06 JonathanBennett

Any news about this feature? I want option i can give the url and it will remove this url from redis cache. Thanks in advance

yagobski avatar Jul 14 '15 22:07 yagobski

Sorry both, I have this on a branch but haven't had time to test it. Does someone want to peer review? I'll commit for vis.

If you do a DELETE request on the URL removes from cache.

/cc @dottodot @yagobski

JonathanBennett avatar Jul 22 '15 14:07 JonathanBennett

OK I have confirmed that req.method is DELETE and redis_online is true but that means it won't work as this would be true

if (req.method !== 'GET' || redis_online !== true)

should it not be

if (req.method !== 'GET' && req.method !== 'DELETE' || redis_online !== true)

I have tried this but I then get the following error

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (http.js:690:11)
    at /Users/marcus/hosts/prerender/lib/server.js:416:21
    at Array.forEach (native)
    at /Users/marcus/hosts/prerender/lib/server.js:415:35
    at next (/Users/marcus/hosts/prerender/lib/server.js:57:28)
    at next (/Users/marcus/hosts/prerender/lib/server.js:64:13)
    at Object.module.exports.beforeSend (/Users/marcus/hosts/prerender/lib/plugins/httpHeaders.js:33:9)
    at next (/Users/marcus/hosts/prerender/lib/server.js:62:20)
    at Object.module.exports.beforeSend (/Users/marcus/hosts/prerender/lib/plugins/removeScriptTags.js:14:9)
    at next (/Users/marcus/hosts/prerender/lib/server.js:62:20)

dottodot avatar Jul 23 '15 12:07 dottodot

Any movement on this, guys?

kingsloi avatar May 11 '17 14:05 kingsloi

So, 3 years later and I'm coming around to using this package again.

Version 0.3.0 (branch delete-url) allows you to DELETE on an endpoint, which will cause it to delete from the cache and then fetch the new version before returning the content.

Let me know if this works for you all! (Only took 3 years!) If so, we'll get it merged and released as v0.3.0

JonathanBennett avatar Apr 19 '20 22:04 JonathanBennett