Skip to content

Commit c4512ed

Browse files
committed
make caches.get smarter
1 parent 8a08b6f commit c4512ed

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/cache.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@
2727

2828
Cache.prototype.get = function(options, cb) {
2929
var conn = this.conn;
30+
var name = options.name || options.cache || options.cacheName;
31+
var env = options.env || options.environment;
32+
if (!env) {
33+
return cb({error:"missing environment name for cache"});
34+
}
3035
common.mergeRequestOptions(conn, function(requestOptions) {
31-
requestOptions.url = urljoin(conn.urlBase, 'e', options.env, 'caches');
36+
requestOptions.url = (options.name) ?
37+
urljoin(conn.urlBase, 'e', env, 'caches', name) :
38+
urljoin(conn.urlBase, 'e', env, 'caches') ;
3239
if (conn.verbosity>0) {
3340
utility.logWrite(sprintf('GET %s', requestOptions.url));
3441
}

0 commit comments

Comments
 (0)