fix:remove tagging from caches to enable dynamo db

This commit is contained in:
hackerESQ
2024-10-23 13:43:34 -05:00
parent 339de1ac9a
commit 2995f8b37e
5 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ class DashboardController extends Controller
$user = $request->user()->load(['portfolios', 'holdings', 'transactions']); $user = $request->user()->load(['portfolios', 'holdings', 'transactions']);
// get portfolio metrics // get portfolio metrics
$metrics = cache()->tags(['metrics', 'dashboard', $user->id])->remember( $metrics = cache()->remember(
'dashboard-metrics-' . $user->id, 'dashboard-metrics-' . $user->id,
10, 10,
function () { function () {
+1 -1
View File
@@ -29,7 +29,7 @@ class PortfolioController extends Controller
$portfolio->load(['transactions', 'holdings']); $portfolio->load(['transactions', 'holdings']);
// get portfolio metrics // get portfolio metrics
$metrics = cache()->tags(['metrics', 'portfolio', $portfolio->id])->remember( $metrics = cache()->remember(
'portfolio-metrics-' . $portfolio->id, 'portfolio-metrics-' . $portfolio->id,
60, 60,
function () use ($portfolio) { function () use ($portfolio) {
@@ -20,8 +20,8 @@ class AlphaVantageMarketData implements MarketDataInterface
$quote = Alphavantage::core()->quoteEndpoint($symbol); $quote = Alphavantage::core()->quoteEndpoint($symbol);
$quote = Arr::get($quote, 'Global Quote', []); $quote = Arr::get($quote, 'Global Quote', []);
$fundamental = cache()->tags(['quote', 'alpha-vantage', $symbol])->remember( $fundamental = cache()->remember(
'symbol-'.$symbol, 'av-symbol-'.$symbol,
1440, 1440,
function () use ($symbol) { function () use ($symbol) {
return Alphavantage::fundamentals()->overview($symbol); return Alphavantage::fundamentals()->overview($symbol);
@@ -30,8 +30,8 @@ class FinnhubMarketData implements MarketDataInterface
$quote = $this->client->quote($symbol); $quote = $this->client->quote($symbol);
$fundamental = cache()->tags(['quote', 'finnhub', $symbol])->remember( $fundamental = cache()->remember(
'symbol-'.$symbol, 'fh-symbol-'.$symbol,
1440, 1440,
function () use ($symbol) { function () use ($symbol) {
return $this->client->companyBasicFinancials($symbol, "all"); return $this->client->companyBasicFinancials($symbol, "all");
+2 -2
View File
@@ -52,14 +52,14 @@ class Transaction extends Model
$transaction->refreshMarketData(); $transaction->refreshMarketData();
cache()->tags(['metrics', $transaction->portfolio_id])->flush(); cache()->forget('portfolio-metrics-' . $transaction->portfolio_id);
}); });
static::deleted(function ($transaction) { static::deleted(function ($transaction) {
$transaction->syncToHolding(); $transaction->syncToHolding();
cache()->tags(['metrics', $transaction->portfolio_id])->flush(); cache()->forget('portfolio-metrics-' . $transaction->portfolio_id);
}); });
} }