diff --git a/README.md b/README.md index 7e7c2e50c..5f2420cd0 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,10 @@ are 3 different caches: * transaction spent information * scriptPubKey for unspent transactions -Cache data is only filled on request, i.e., only after accessing the required data for -the first time, the information is cached, there is not pre-caching procedure. - -To ignore cache, use INSIGHT_IGNORE_CACHE; +Cache data is only populated on request, i.e., only after accessing the required data for +the first time, the information is cached, there is not pre-caching procedure. To ignore +cache by default, use INSIGHT_IGNORE_CACHE. Also, address related calls support `?noCache=1` +to ignore the cache in a particular API request. ## Prerequisites @@ -167,12 +167,12 @@ The end-points are: ``` ### Address ``` - /api/addr/[:addr][?noTxList=1] + /api/addr/[:addr][?noTxList=1&noCache=1] /api/addr/mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5?noTxList=1 ``` ### Unspent Outputs ``` - /api/addr/[:addr]/utxo + /api/addr/[:addr]/utxo[?noCache=1] ``` Sample return: ``` json @@ -197,8 +197,8 @@ Sample return: } ] ``` -Please not that in case confirmations are cached and are more that SAFE_CONFIRMATIONS setting, the -return can be a string of the form 'SAFE_CONFIRMATIONS+' +Please not that in case confirmations are cached and are more that INSIGHT_SAFE_CONFIRMATIONS setting, the +return can be a string of the form `SAFE_CONFIRMATIONS+`, e.g.: the string `6+` ### Unspent Outputs for multiple addresses diff --git a/app/controllers/addresses.js b/app/controllers/addresses.js index 3f405858d..7678d4f0f 100644 --- a/app/controllers/addresses.js +++ b/app/controllers/addresses.js @@ -53,7 +53,7 @@ exports.show = function(req, res, next) { } else { return res.jsonp(a.getObj()); } - }, {txLimit: req.query.noTxList?0:-1, ignoreCache: req.param('nocache')}); + }, {txLimit: req.query.noTxList?0:-1, ignoreCache: req.param('noCache')}); } }; @@ -68,7 +68,7 @@ exports.utxo = function(req, res, next) { else { return res.jsonp(a.unspent); } - }, {onlyUnspent:1, ignoreCache: req.param('nocache')}); + }, {onlyUnspent:1, ignoreCache: req.param('noCache')}); } }; @@ -81,7 +81,7 @@ exports.multiutxo = function(req, res, next) { if (err) callback(err); utxos = utxos.concat(a.unspent); callback(); - }, {onlyUnspent:1, ignoreCache: req.param('nocache')}); + }, {onlyUnspent:1, ignoreCache: req.param('noCache')}); }, function(err) { // finished callback if (err) return common.handleErrors(err, res); res.jsonp(utxos); @@ -99,7 +99,7 @@ exports.balance = function(req, res, next) { } else { return res.jsonp(a.balanceSat); } - }, {ignoreCache: req.param('nocache')}); + }, {ignoreCache: req.param('noCache')}); }; exports.totalReceived = function(req, res, next) { @@ -111,7 +111,7 @@ exports.totalReceived = function(req, res, next) { } else { return res.jsonp(a.totalReceivedSat); } - }, {ignoreCache: req.param('nocache')}); + }, {ignoreCache: req.param('noCache')}); }; exports.totalSent = function(req, res, next) { @@ -123,7 +123,7 @@ exports.totalSent = function(req, res, next) { } else { return res.jsonp(a.totalSentSat); } - }, {ignoreCache: req.param('nocache')}); + }, {ignoreCache: req.param('noCache')}); }; exports.unconfirmedBalance = function(req, res, next) { @@ -135,5 +135,5 @@ exports.unconfirmedBalance = function(req, res, next) { } else { return res.jsonp(a.unconfirmedBalanceSat); } - }, {ignoreCache: req.param('nocache')}); + }, {ignoreCache: req.param('noCache')}); };