mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Extra cache.
This commit is contained in:
parent
72d054c55c
commit
9f7c6c2d0c
@ -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 AccountRepositoryInterface
|
||||
public 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 Account
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user