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

Advice for new entry on header change #20

Closed
dwest-ee opened this issue Jan 22, 2015 · 2 comments
Closed

Advice for new entry on header change #20

dwest-ee opened this issue Jan 22, 2015 · 2 comments

Comments

@dwest-ee
Copy link

Hi,

I would like to create a new entry when there is a difference in the header. For example for X-Requested-With or if a cookie is present. Is this something I can do using this module?

@co2-git
Copy link
Collaborator

co2-git commented Jan 22, 2015

Yes, you could do so using the res.express_redis_cache_name variable. For example:

app.get('/',
  // pre-cache middleware
  function (req, res, next) {
    // If set, express_redis_cache_name will be used as the cache name
    res.express_redis_cache_name = req.path + req.get('x-requested-with');
    next();
  },

  // cache middleware
  cache.route(),

  // your route middleware
  function (req, res) {  /* ... */  }
);

@dwest-ee
Copy link
Author

Brilliant. Thank you for your advice @co2-git.

@co2-git co2-git closed this as completed Jan 28, 2015
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

2 participants