/home/techb158/ileadtechnology.com/SSM/vendor/laravel/telescope/src/Watchers
Edit: /home/techb158/ileadtechnology.com/SSM/vendor/laravel/telescope/src/Watchers/CacheWatcher.php (3381B)
listen(CacheHit::class, [$this, 'recordCacheHit']);
$app['events']->listen(CacheMissed::class, [$this, 'recordCacheMissed']);
$app['events']->listen(KeyWritten::class, [$this, 'recordKeyWritten']);
$app['events']->listen(KeyForgotten::class, [$this, 'recordKeyForgotten']);
}
/**
* Record a cache key was found.
*
* @param \Illuminate\Cache\Events\CacheHit $event
* @return void
*/
public function recordCacheHit(CacheHit $event)
{
if (! Telescope::isRecording() || $this->shouldIgnore($event)) {
return;
}
Telescope::recordCache(IncomingEntry::make([
'type' => 'hit',
'key' => $event->key,
'value' => $event->value,
]));
}
/**
* Record a missing cache key.
*
* @param \Illuminate\Cache\Events\CacheMissed $event
* @return void
*/
public function recordCacheMissed(CacheMissed $event)
{
if (! Telescope::isRecording() || $this->shouldIgnore($event)) {
return;
}
Telescope::recordCache(IncomingEntry::make([
'type' => 'missed',
'key' => $event->key,
]));
}
/**
* Record a cache key was updated.
*
* @param \Illuminate\Cache\Events\KeyWritten $event
* @return void
*/
public function recordKeyWritten(KeyWritten $event)
{
if (! Telescope::isRecording() || $this->shouldIgnore($event)) {
return;
}
Telescope::recordCache(IncomingEntry::make([
'type' => 'set',
'key' => $event->key,
'value' => $event->value,
'expiration' => $this->formatExpiration($event),
]));
}
/**
* Record a cache key was forgotten / removed.
*
* @param \Illuminate\Cache\Events\KeyForgotten $event
* @return void
*/
public function recordKeyForgotten(KeyForgotten $event)
{
if (! Telescope::isRecording() || $this->shouldIgnore($event)) {
return;
}
Telescope::recordCache(IncomingEntry::make([
'type' => 'forget',
'key' => $event->key,
]));
}
/**
* @param \Illuminate\Cache\Events\KeyWritten $event
* @return mixed
*/
protected function formatExpiration(KeyWritten $event)
{
return property_exists($event, 'seconds')
? $event->seconds : $event->minutes * 60;
}
/**
* Determine if the event should be ignored.
*
* @param mixed $event
* @return bool
*/
private function shouldIgnore($event)
{
return Str::is([
'illuminate:queue:restart',
'framework/schedule*',
'telescope:*',
], $event->key);
}
}