add per call cache disable options

This commit is contained in:
Matias Alejo Garcia 2014-05-30 14:19:13 -03:00
parent 985ca1ac39
commit 7becad01aa
2 changed files with 15 additions and 15 deletions

View File

@ -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

View File

@ -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')});
};