You are here

public function CacheLogger::save in Ultimate Cron 8.2

Saves a log entry.

Parameters

\Drupal\ultimate_cron\Logger\LogEntry $log_entry: The log entry to save.

Overrides LoggerInterface::save

File

src/Plugin/ultimate_cron/Logger/CacheLogger.php, line 112

Class

CacheLogger
Cache Logger.

Namespace

Drupal\ultimate_cron\Plugin\ultimate_cron\Logger

Code

public function save(LogEntry $log_entry) {
  if (!$log_entry->lid) {
    return;
  }
  $settings = $this
    ->getConfiguration();
  $expire = $settings['timeout'] != Cache::PERMANENT ? REQUEST_TIME + $settings['timeout'] : $settings['timeout'];
  $this->cache
    ->set('uc-name:' . $log_entry->name, $log_entry->lid, $expire);
  $this->cache
    ->set('uc-lid:' . $log_entry->lid, $log_entry
    ->getData(), $expire);
}