-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathFlushTagFromFileCacheJob.php
50 lines (43 loc) · 1.17 KB
/
FlushTagFromFileCacheJob.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace Unikent\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class FlushTagFromFileCacheJob implements ShouldQueue
{
/*
|--------------------------------------------------------------------------
| Queueable Jobs
|--------------------------------------------------------------------------
|
| This job base class provides a central location to place any logic that
| is shared across all of your jobs. The trait included with the class
| provides access to the "queueOn" and "delay" queue helper methods.
|
*/
use InteractsWithQueue, Queueable, SerializesModels;
protected $tagIds;
protected $driver;
/**
* Create a new job instance.
*
* @param $ids array of tagIds to find and purge
*/
public function __construct( $ids , $driver = 'tfile')
{
$this->tagIds = is_array($ids)?$ids:[$ids];
$this->driver = $driver;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
foreach($this->tagIds as $id){
app('cache')->driver($this->driver)->flushOldTag($id);
}
}
}