Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Extra cache.
James Cole9f7c6c2d0c5e
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.phpindex 2668c85938..cdadf440c7 100644--- a/app/Repositories/Account/AccountRepository.php+++ b/app/Repositories/Account/AccountRepository.php@@ -41,7 +41,16 @@ class AccountRepository implements AccountRepositoryInterface*/public function countAccounts(array $types){- return Auth::user()->accounts()->accountTypeIn($types)->count();+ $cache = new CacheProperties;+ $cache->addProperty('user-count-accounts');+ if ($cache->has()) {+ return $cache->get(); // @codeCoverageIgnore+ }++ $count = Auth::user()->accounts()->accountTypeIn($types)->count();+ $cache->store($count);++ return $count;}/**@@ -123,8 +132,7 @@ class AccountRepository implements AccountRepositoryInterfacepublic function getFrontpageAccounts(Preference $preference){$cache = new CacheProperties();- $cache->addProperty($preference->data);- $cache->addProperty('frontPageaccounts');+ $cache->addProperty('user-frontpage-accounts');if ($cache->has()) {return $cache->get(); // @codeCoverageIgnore}@@ -229,7 +237,7 @@ class AccountRepository implements AccountRepositoryInterface$cache = new CacheProperties;$cache->addProperty($ids);- $cache->addProperty('piggyAccounts');+ $cache->addProperty('user-piggy-bank-accounts');if ($cache->has()) {return $cache->get(); // @codeCoverageIgnore}@@ -648,6 +656,7 @@ class AccountRepository implements AccountRepositoryInterface/*** @deprecated+ ** @param $accountId** @return Accountdiff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.phpindex 3fd766b1a5..b86a6704f3 100644--- a/app/Repositories/Journal/JournalRepository.php+++ b/app/Repositories/Journal/JournalRepository.php@@ -13,6 +13,7 @@ use FireflyIII\Models\Tag;use FireflyIII\Models\Transaction;use FireflyIII\Models\TransactionJournal;use FireflyIII\Models\TransactionType;+use FireflyIII\Support\CacheProperties;use Illuminate\Pagination\LengthAwarePaginator;use Illuminate\Support\Collection;use Log;@@ -44,7 +45,16 @@ class JournalRepository implements JournalRepositoryInterface*/public function first(){- return Auth::user()->transactionjournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']);+ $cache = new CacheProperties;+ $cache->addProperty('user-first-journal');+ if ($cache->has()) {+ return $cache->get(); // @codeCoverageIgnore+ }++ $entry = Auth::user()->transactionjournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']);+ $cache->store($entry);++ return $entry;}/**