Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 621
Zeile 1... Zeile 1...
1
<?php
1
<?php
Zeile 2... Zeile 2...
2
 
2
 
Zeile 3... Zeile 3...
3
namespace Illuminate\Console\Scheduling;
3
namespace Illuminate\Console\Scheduling;
-
 
4
 
Zeile 4... Zeile 5...
4
 
5
use Illuminate\Contracts\Cache\Factory as Cache;
5
use Illuminate\Contracts\Cache\Factory as Cache;
6
use Illuminate\Contracts\Cache\LockProvider;
6
 
7
 
7
class CacheEventMutex implements EventMutex, CacheAware
8
class CacheEventMutex implements EventMutex, CacheAware
Zeile 37... Zeile 38...
37
     * @param  \Illuminate\Console\Scheduling\Event  $event
38
     * @param  \Illuminate\Console\Scheduling\Event  $event
38
     * @return bool
39
     * @return bool
39
     */
40
     */
40
    public function create(Event $event)
41
    public function create(Event $event)
41
    {
42
    {
-
 
43
        if ($this->cache->store($this->store)->getStore() instanceof LockProvider) {
-
 
44
            return $this->cache->store($this->store)->getStore()
-
 
45
                ->lock($event->mutexName(), $event->expiresAt * 60)
-
 
46
                ->acquire();
-
 
47
        }
-
 
48
 
42
        return $this->cache->store($this->store)->add(
49
        return $this->cache->store($this->store)->add(
43
            $event->mutexName(), true, $event->expiresAt * 60
50
            $event->mutexName(), true, $event->expiresAt * 60
44
        );
51
        );
45
    }
52
    }
Zeile 50... Zeile 57...
50
     * @param  \Illuminate\Console\Scheduling\Event  $event
57
     * @param  \Illuminate\Console\Scheduling\Event  $event
51
     * @return bool
58
     * @return bool
52
     */
59
     */
53
    public function exists(Event $event)
60
    public function exists(Event $event)
54
    {
61
    {
-
 
62
        if ($this->cache->store($this->store)->getStore() instanceof LockProvider) {
-
 
63
            return ! $this->cache->store($this->store)->getStore()
-
 
64
                ->lock($event->mutexName(), $event->expiresAt * 60)
-
 
65
                ->get(fn () => true);
-
 
66
        }
-
 
67
 
55
        return $this->cache->store($this->store)->has($event->mutexName());
68
        return $this->cache->store($this->store)->has($event->mutexName());
56
    }
69
    }
Zeile 57... Zeile 70...
57
 
70
 
58
    /**
71
    /**
Zeile 61... Zeile 74...
61
     * @param  \Illuminate\Console\Scheduling\Event  $event
74
     * @param  \Illuminate\Console\Scheduling\Event  $event
62
     * @return void
75
     * @return void
63
     */
76
     */
64
    public function forget(Event $event)
77
    public function forget(Event $event)
65
    {
78
    {
-
 
79
        if ($this->cache->store($this->store)->getStore() instanceof LockProvider) {
-
 
80
            $this->cache->store($this->store)->getStore()
-
 
81
                ->lock($event->mutexName(), $event->expiresAt * 60)
-
 
82
                ->forceRelease();
-
 
83
 
-
 
84
            return;
-
 
85
        }
-
 
86
 
66
        $this->cache->store($this->store)->forget($event->mutexName());
87
        $this->cache->store($this->store)->forget($event->mutexName());
67
    }
88
    }
Zeile 68... Zeile 89...
68
 
89
 
69
    /**
90
    /**