Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear cache #7

Open
dottodot opened this issue Jun 2, 2015 · 6 comments
Open

Clear cache #7

dottodot opened this issue Jun 2, 2015 · 6 comments

Comments

@dottodot
Copy link

dottodot commented Jun 2, 2015

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

@JonathanBennett
Copy link
Owner

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.

@yagobski
Copy link

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

@JonathanBennett
Copy link
Owner

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

@dottodot
Copy link
Author

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)

@kingsloi
Copy link

Any movement on this, guys?

@JonathanBennett
Copy link
Owner

JonathanBennett commented Apr 19, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants