add per call cache disable options
This commit is contained in:
parent
985ca1ac39
commit
7becad01aa
16
README.md
16
README.md
@ -32,10 +32,10 @@ are 3 different caches:
|
|||||||
* transaction spent information
|
* transaction spent information
|
||||||
* scriptPubKey for unspent transactions
|
* scriptPubKey for unspent transactions
|
||||||
|
|
||||||
Cache data is only filled on request, i.e., only after accessing the required data for
|
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.
|
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 cache, use INSIGHT_IGNORE_CACHE;
|
to ignore the cache in a particular API request.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
@ -167,12 +167,12 @@ The end-points are:
|
|||||||
```
|
```
|
||||||
### Address
|
### Address
|
||||||
```
|
```
|
||||||
/api/addr/[:addr][?noTxList=1]
|
/api/addr/[:addr][?noTxList=1&noCache=1]
|
||||||
/api/addr/mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5?noTxList=1
|
/api/addr/mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5?noTxList=1
|
||||||
```
|
```
|
||||||
### Unspent Outputs
|
### Unspent Outputs
|
||||||
```
|
```
|
||||||
/api/addr/[:addr]/utxo
|
/api/addr/[:addr]/utxo[?noCache=1]
|
||||||
```
|
```
|
||||||
Sample return:
|
Sample return:
|
||||||
``` json
|
``` json
|
||||||
@ -197,8 +197,8 @@ Sample return:
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
Please not that in case confirmations are cached and are more that SAFE_CONFIRMATIONS setting, the
|
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+'
|
return can be a string of the form `SAFE_CONFIRMATIONS+`, e.g.: the string `6+`
|
||||||
|
|
||||||
|
|
||||||
### Unspent Outputs for multiple addresses
|
### Unspent Outputs for multiple addresses
|
||||||
|
|||||||
@ -53,7 +53,7 @@ exports.show = function(req, res, next) {
|
|||||||
} else {
|
} else {
|
||||||
return res.jsonp(a.getObj());
|
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 {
|
else {
|
||||||
return res.jsonp(a.unspent);
|
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);
|
if (err) callback(err);
|
||||||
utxos = utxos.concat(a.unspent);
|
utxos = utxos.concat(a.unspent);
|
||||||
callback();
|
callback();
|
||||||
}, {onlyUnspent:1, ignoreCache: req.param('nocache')});
|
}, {onlyUnspent:1, ignoreCache: req.param('noCache')});
|
||||||
}, function(err) { // finished callback
|
}, function(err) { // finished callback
|
||||||
if (err) return common.handleErrors(err, res);
|
if (err) return common.handleErrors(err, res);
|
||||||
res.jsonp(utxos);
|
res.jsonp(utxos);
|
||||||
@ -99,7 +99,7 @@ exports.balance = function(req, res, next) {
|
|||||||
} else {
|
} else {
|
||||||
return res.jsonp(a.balanceSat);
|
return res.jsonp(a.balanceSat);
|
||||||
}
|
}
|
||||||
}, {ignoreCache: req.param('nocache')});
|
}, {ignoreCache: req.param('noCache')});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.totalReceived = function(req, res, next) {
|
exports.totalReceived = function(req, res, next) {
|
||||||
@ -111,7 +111,7 @@ exports.totalReceived = function(req, res, next) {
|
|||||||
} else {
|
} else {
|
||||||
return res.jsonp(a.totalReceivedSat);
|
return res.jsonp(a.totalReceivedSat);
|
||||||
}
|
}
|
||||||
}, {ignoreCache: req.param('nocache')});
|
}, {ignoreCache: req.param('noCache')});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.totalSent = function(req, res, next) {
|
exports.totalSent = function(req, res, next) {
|
||||||
@ -123,7 +123,7 @@ exports.totalSent = function(req, res, next) {
|
|||||||
} else {
|
} else {
|
||||||
return res.jsonp(a.totalSentSat);
|
return res.jsonp(a.totalSentSat);
|
||||||
}
|
}
|
||||||
}, {ignoreCache: req.param('nocache')});
|
}, {ignoreCache: req.param('noCache')});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.unconfirmedBalance = function(req, res, next) {
|
exports.unconfirmedBalance = function(req, res, next) {
|
||||||
@ -135,5 +135,5 @@ exports.unconfirmedBalance = function(req, res, next) {
|
|||||||
} else {
|
} else {
|
||||||
return res.jsonp(a.unconfirmedBalanceSat);
|
return res.jsonp(a.unconfirmedBalanceSat);
|
||||||
}
|
}
|
||||||
}, {ignoreCache: req.param('nocache')});
|
}, {ignoreCache: req.param('noCache')});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user