Skip to content

Commit

Permalink
Make addressBelongsToWallet() Cache expire after 7 days, in order to …
Browse files Browse the repository at this point in the history
…avoid huge storage usage.
  • Loading branch information
Tate Peñaranda committed Oct 22, 2018
1 parent 4922f36 commit 174a512
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This packages integrates a Bitcoin (bcoin.io) node to a Laravel App by using BCo
Also, it performs some calculations that bcoin node doesn't provide.
Some basic Cache is used to avoid unnecesary API calls.

Donations => bitcoin:38NYkcaqSCxijvsfvgGexPsNkVZLfaTw54
Donations => bitcoin:3EVvypgXMWp3R2gWeJSzEhurMJcKtYgmL1

## Installation for Laravel 5

Expand Down Expand Up @@ -293,4 +293,4 @@ Example of bcoin server fire up (Listen on port 8333, so TCP 8332, 8333 and 8334
>>>
```

## Donations => bitcoin:38NYkcaqSCxijvsfvgGexPsNkVZLfaTw54
## Donations => bitcoin:3EVvypgXMWp3R2gWeJSzEhurMJcKtYgmL1
2 changes: 1 addition & 1 deletion src/BCoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function getCoin(string $hash, int $index)

public static function addressBelongsToWallet(string $address, string $wallet_id): bool
{
return Cache::rememberForever("tpenaranda-bcoin:address-{$address}-belongs-to-wallet-{$wallet_id}", function () use ($wallet_id, $address) {
return Cache::remember("tpenaranda-bcoin:address-{$address}-belongs-to-wallet-{$wallet_id}", $minutes = 60 * 24 * 7, function () use ($wallet_id, $address) {
try {
return (bool) static::getFromWalletAPI("/wallet/{$wallet_id}/key/{$address}");
} catch (GuzzleClientException $e) {
Expand Down

0 comments on commit 174a512

Please sign in to comment.