fix:remove tagging from caches to enable dynamo db
This commit is contained in:
@@ -15,7 +15,7 @@ class DashboardController extends Controller
|
||||
$user = $request->user()->load(['portfolios', 'holdings', 'transactions']);
|
||||
|
||||
// get portfolio metrics
|
||||
$metrics = cache()->tags(['metrics', 'dashboard', $user->id])->remember(
|
||||
$metrics = cache()->remember(
|
||||
'dashboard-metrics-' . $user->id,
|
||||
10,
|
||||
function () {
|
||||
|
||||
@@ -29,7 +29,7 @@ class PortfolioController extends Controller
|
||||
$portfolio->load(['transactions', 'holdings']);
|
||||
|
||||
// get portfolio metrics
|
||||
$metrics = cache()->tags(['metrics', 'portfolio', $portfolio->id])->remember(
|
||||
$metrics = cache()->remember(
|
||||
'portfolio-metrics-' . $portfolio->id,
|
||||
60,
|
||||
function () use ($portfolio) {
|
||||
|
||||
@@ -20,8 +20,8 @@ class AlphaVantageMarketData implements MarketDataInterface
|
||||
$quote = Alphavantage::core()->quoteEndpoint($symbol);
|
||||
$quote = Arr::get($quote, 'Global Quote', []);
|
||||
|
||||
$fundamental = cache()->tags(['quote', 'alpha-vantage', $symbol])->remember(
|
||||
'symbol-'.$symbol,
|
||||
$fundamental = cache()->remember(
|
||||
'av-symbol-'.$symbol,
|
||||
1440,
|
||||
function () use ($symbol) {
|
||||
return Alphavantage::fundamentals()->overview($symbol);
|
||||
|
||||
@@ -30,8 +30,8 @@ class FinnhubMarketData implements MarketDataInterface
|
||||
|
||||
$quote = $this->client->quote($symbol);
|
||||
|
||||
$fundamental = cache()->tags(['quote', 'finnhub', $symbol])->remember(
|
||||
'symbol-'.$symbol,
|
||||
$fundamental = cache()->remember(
|
||||
'fh-symbol-'.$symbol,
|
||||
1440,
|
||||
function () use ($symbol) {
|
||||
return $this->client->companyBasicFinancials($symbol, "all");
|
||||
|
||||
@@ -52,14 +52,14 @@ class Transaction extends Model
|
||||
|
||||
$transaction->refreshMarketData();
|
||||
|
||||
cache()->tags(['metrics', $transaction->portfolio_id])->flush();
|
||||
cache()->forget('portfolio-metrics-' . $transaction->portfolio_id);
|
||||
});
|
||||
|
||||
static::deleted(function ($transaction) {
|
||||
|
||||
$transaction->syncToHolding();
|
||||
|
||||
cache()->tags(['metrics', $transaction->portfolio_id])->flush();
|
||||
cache()->forget('portfolio-metrics-' . $transaction->portfolio_id);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user