1
1
<?php
2
2
3
- namespace MailCarrier \Actions \Logs \ Widgets ;
3
+ namespace MailCarrier \Actions \Widgets ;
4
4
5
5
use Flowframe \Trend \Trend ;
6
6
use Illuminate \Support \Carbon ;
7
7
use Illuminate \Support \Collection ;
8
+ use Illuminate \Support \Facades \Cache ;
8
9
use MailCarrier \Actions \Action ;
9
- use MailCarrier \Concerns \InteractsWithCache ;
10
10
use MailCarrier \Dto \Dashboard \SentFailureChartDto ;
11
11
use MailCarrier \Enums \Dashboard \SentFailureChartFilter ;
12
12
use MailCarrier \Enums \LogStatus ;
13
13
use MailCarrier \Models \Log ;
14
14
15
15
class GetSentFailureStats extends Action
16
16
{
17
- use InteractsWithCache;
18
-
19
17
protected SentFailureChartFilter $ filter ;
20
18
21
19
/**
@@ -25,9 +23,22 @@ public function run(SentFailureChartFilter $filter): SentFailureChartDto
25
23
{
26
24
$ this ->filter = $ filter ;
27
25
28
- return $ this
29
- ->withCacheArgs (func_get_args ())
30
- ->cachedUntil (Carbon::now ()->addMinutes (30 ), $ this ->getData (...));
26
+ return Cache::rememberForever (
27
+ 'dashboard:sent-failure. ' . $ filter ->value ,
28
+ $ this ->getData (...)
29
+ );
30
+ }
31
+
32
+ /**
33
+ * Flush the action cache.
34
+ */
35
+ public static function flush (): void
36
+ {
37
+ foreach (SentFailureChartFilter::cases () as $ filter ) {
38
+ Cache::forget (
39
+ 'dashboard:sent-failure. ' . $ filter ->value ,
40
+ );
41
+ }
31
42
}
32
43
33
44
/**
0 commit comments