1 | <?php |
||
12 | class CacheableObserver |
||
13 | { |
||
14 | /** |
||
15 | * Event dispatcher object. |
||
16 | * |
||
17 | * @var \Illuminate\Contracts\Events\Dispatcher |
||
18 | */ |
||
19 | protected $events; |
||
20 | |||
21 | /** |
||
22 | * Cacheable observer constructor. |
||
23 | * |
||
24 | * @param \Illuminate\Contracts\Events\Dispatcher $events |
||
25 | */ |
||
26 | public function __construct(Dispatcher $events) |
||
30 | |||
31 | /** |
||
32 | * Fire cacheable events. |
||
33 | * |
||
34 | * @param \Suitmedia\Cacheable\Events\CacheableEvent $event |
||
35 | * |
||
36 | * @return mixed |
||
37 | */ |
||
38 | public function fireEvent(CacheableEvent $event) |
||
46 | |||
47 | /** |
||
48 | * Tell the cacheable service to flush all cache |
||
49 | * that related to the given model. |
||
50 | * |
||
51 | * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model |
||
52 | * |
||
53 | * @return void |
||
54 | */ |
||
55 | protected function flushCache(CacheableModel $model) |
||
65 | |||
66 | /** |
||
67 | * Saved event handler. |
||
68 | * |
||
69 | * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model |
||
70 | * |
||
71 | * @return void |
||
72 | */ |
||
73 | public function saved(CacheableModel $model) |
||
77 | |||
78 | /** |
||
79 | * Deleted event handler. |
||
80 | * |
||
81 | * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model |
||
82 | * |
||
83 | * @return void |
||
84 | */ |
||
85 | public function deleted(CacheableModel $model) |
||
89 | |||
90 | /** |
||
91 | * Restored event handler. |
||
92 | * |
||
93 | * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model |
||
94 | * |
||
95 | * @return void |
||
96 | */ |
||
97 | public function restored(CacheableModel $model) |
||
101 | } |
||
102 |