|
| 1 | +<?php namespace App\Jobs; |
| 2 | +/** |
| 3 | + * Copyright 2018 OpenStack Foundation |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + * Unless required by applicable law or agreed to in writing, software |
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | + * See the License for the specific language governing permissions and |
| 12 | + * limitations under the License. |
| 13 | + **/ |
| 14 | +use App\Services\Model\IMemberService; |
| 15 | +use Illuminate\Bus\Queueable; |
| 16 | +use Illuminate\Contracts\Queue\ShouldQueue; |
| 17 | +use Illuminate\Foundation\Bus\Dispatchable; |
| 18 | +use Illuminate\Queue\InteractsWithQueue; |
| 19 | +use Illuminate\Queue\SerializesModels; |
| 20 | +use Illuminate\Support\Facades\Log; |
| 21 | + |
| 22 | +class CleanMemberCacheJob implements ShouldQueue |
| 23 | +{ |
| 24 | + public $tries = 2; |
| 25 | + |
| 26 | + // no timeout |
| 27 | + public $timeout = 0; |
| 28 | + |
| 29 | + use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
| 30 | + |
| 31 | + /** |
| 32 | + * @var int |
| 33 | + */ |
| 34 | + private $member_id; |
| 35 | + |
| 36 | + /** |
| 37 | + * NewMember constructor. |
| 38 | + * @param int $member_id |
| 39 | + */ |
| 40 | + public function __construct(int $member_id) |
| 41 | + { |
| 42 | + $this->member_id = $member_id; |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * @param IMemberService $service |
| 47 | + */ |
| 48 | + public function handle(IMemberService $service) |
| 49 | + { |
| 50 | + Log::debug(sprintf("CleanMemberCacheJob::handle member_id %s", $this->member_id)); |
| 51 | + $service->cleanMemberRelatedCacheData($this->member_id); |
| 52 | + } |
| 53 | +} |
0 commit comments