UNPKG

375 BJavaScriptView Raw
1'use strict';
2
3module.exports = function getCacheKeyGenerator (opts) {
4
5 /**
6 * Generate the key to use for caching this request
7 * @param {IncomingRequest} req
8 * @return {String}
9 */
10 return function genCacheKey (req) {
11 if (opts.genCacheKey) {
12 return opts.genCacheKey(req);
13 } else {
14 return req.method + ' - ' + req.originalUrl;
15 }
16 };
17};