Skip to content

Commit

Permalink
add per call cache disable options
Browse files Browse the repository at this point in the history
  • Loading branch information
matiu committed May 30, 2014
1 parent 985ca1a commit 7becad0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions app/controllers/addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')});
}
};

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

Expand All @@ -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);
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -135,5 +135,5 @@ exports.unconfirmedBalance = function(req, res, next) {
} else {
return res.jsonp(a.unconfirmedBalanceSat);
}
}, {ignoreCache: req.param('nocache')});
}, {ignoreCache: req.param('noCache')});
};

0 comments on commit 7becad0

Please sign in to comment.