Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Cache\Console;
4
 
5
use Illuminate\Cache\CacheManager;
6
use Illuminate\Console\Command;
7
use Symfony\Component\Console\Attribute\AsCommand;
8
 
9
#[AsCommand(name: 'cache:forget')]
10
class ForgetCommand extends Command
11
{
12
    /**
13
     * The console command name.
14
     *
15
     * @var string
16
     */
17
    protected $signature = 'cache:forget {key : The key to remove} {store? : The store to remove the key from}';
18
 
19
    /**
20
     * The name of the console command.
21
     *
22
     * This name is used to identify the command during lazy loading.
23
     *
24
     * @var string|null
25
     *
26
     * @deprecated
27
     */
28
    protected static $defaultName = 'cache:forget';
29
 
30
    /**
31
     * The console command description.
32
     *
33
     * @var string
34
     */
35
    protected $description = 'Remove an item from the cache';
36
 
37
    /**
38
     * The cache manager instance.
39
     *
40
     * @var \Illuminate\Cache\CacheManager
41
     */
42
    protected $cache;
43
 
44
    /**
45
     * Create a new cache clear command instance.
46
     *
47
     * @param  \Illuminate\Cache\CacheManager  $cache
48
     * @return void
49
     */
50
    public function __construct(CacheManager $cache)
51
    {
52
        parent::__construct();
53
 
54
        $this->cache = $cache;
55
    }
56
 
57
    /**
58
     * Execute the console command.
59
     *
60
     * @return void
61
     */
62
    public function handle()
63
    {
64
        $this->cache->store($this->argument('store'))->forget(
65
            $this->argument('key')
66
        );
67
 
68
        $this->components->info('The ['.$this->argument('key').'] key has been removed from the cache.');
69
    }
70
}