Writes the message to the configured cache adapter.

@param string $priority
@param string $message
@return \Closure Function returning boolean `true` on successful write, `false` otherwise.
324943
public function write($priority, $message) {
		$config = $this->_config + $this->_classes;

		return function($params) use ($config) {
			$params += ['timestamp' => strtotime('now')];
			$key = $config['key'];
			$key = is_callable($key) ? $key($params) : Text::insert($key, $params);

			$cache = $config['cache'];
			return $cache::write($config['config'], $key, $params['message'], $config['expiry']);
		};
	}
1020550
public function setMessage($message, $priority)
    {
        $this->message = (string) $message;
        $this->priority = (int) $priority;
    }
571402
public function delete(QueueMessage $message)
    {
        $queue = $message->getQueueName() ?: $this->queue;

        $sql = 'DELETE FROM ' . $this->table .
            ' WHERE id = :id AND queue = :queue';

        $stat = $this->pdo->prepare($sql);
        $stat->bindValue(':id', $message->getId());
        $stat->bindValue(':queue', $queue);

        $stat->execute();

        return $this;
    }
111538
public function release($message, $delay = 0)
    {
        if (!$message instanceof QueueMessage) {
            $msg = new QueueMessage();
            $msg->setId($message);
        }

        $message->setDelay($delay);

        $this->driver->release($message);
    }
100124
public function delete(QueueMessage $message)
    {
        $queue = $message->getQueueName() ?: $this->queue;

        $query = $this->db->getQuery(true);

        $query->delete($query->quoteName($this->table))
            ->where('id = :id')
            ->where('queue = :queue')
            ->bind('id', $message->getId())
            ->bind('queue', $queue);

        $this->db->setQuery($query)->execute();

        return $this;
    }
286762
private function log($priority, $msg, $fileHandle = null)
    {
        if ($priority[0] < $this->logLevel && $fileHandle === null) {
            return;
        }

        $logTime = time();

        $this->logQueue[] = new Logger\Message($priority[1], $logTime, $msg);

        /* ensure the output messages line up vertically */
        $prioritystr = '['.$priority[1].']';
        $timestr = '['.date('Y-m-d H:i:s - T', $logTime).']';
        while (strlen($prioritystr) < 7) {
            $prioritystr .= ' ';
        }
        $message = $prioritystr.'  '.$timestr.' '.$msg."\n";
        $message = getmypid().': '.$message;

        if (defined('STDERR')) {
            fputs(STDERR, getmypid().': '.$prioritystr.'  '.$msg."\n");
        } else {
            echo '<!-- LogMessage: '.$message." -->\n";
        }

        if ($this->file != null) {
            if ($fileHandle !== null) {
                fputs($fileHandle, $message);
            } else {
                error_log($message, 3, $this->file);
            }
        } elseif ($fileHandle !== null) {
            fputs($fileHandle, $message);
        }

        if (count($this->logQueue) > $this->max) {
            $this->flush();
        }
    }
1143598
public function push($queueName, Message $message)
    {
        $cache = $this->get($queueName);
        $cache->enqueue($message);
    }
382793
protected function _log($message, $priority = 4)
    {
        if (!$this->_options['logging']) {
            return;
        }
        if (!(isset($this->_options['logger']) || $this->_options['logger'] instanceof Zend_Log)) {
            Zend_Cache::throwException('Logging is enabled but logger is not set');
        }
        $logger = $this->_options['logger'];
        $logger->log($message, $priority);
    }
907380
public function push(QueueMessage $message)
    {
        $queue = $message->getQueueName() ?: $this->queue;

        $options = $message->getOptions();

        $options['delay'] = $message->getDelay();

        return $this->client->postMessage($queue, json_encode($message), $options)->id;
    }
91391
protected function write($message, $severity)
    {
        $logger = $this->getLogger();
        $logger->log($message, $this->getPrestaShopSeverity($severity));
    }
1077763
public function queueMessage(Swift_Mime_SimpleMessage $message)
    {
        $ser = serialize($message);
        $fileName = $this->path.'/'.$this->getRandomString(10);
        for ($i = 0; $i < $this->retryLimit; ++$i) {
            /* We try an exclusive creation of the file. This is an atomic operation, it avoid locking mechanism */
            $fp = @fopen($fileName.'.message', 'xb');
            if (false !== $fp) {
                if (false === fwrite($fp, $ser)) {
                    return false;
                }

                return fclose($fp);
            } else {
                /* The file already exists, we try a longer fileName */
                $fileName .= $this->getRandomString(1);
            }
        }

        throw new Swift_IoException(sprintf('Unable to create a file for enqueuing Message in "%s".', $this->path));
    }
486238
public function delete($message)
    {
        if (!$message instanceof QueueMessage) {
            $msg = new QueueMessage();
            $msg->setId($message);
        }

        $this->driver->delete($message);

        $message->isDeleted(true);
    }
1050279
public static function writeLog($priority, $tag, $msg) // [int priority, String tag, String msg]
    {
        $logger = AxolotlLoggerProvider::getProvider();
        if (($logger != null)) {
            $logger->log($priority, $tag, $msg);
        }
    }
25737
public function push(QueueMessage $message)
    {
        $queue = $message->getQueueName() ?: $this->queue;

        if (!$message->getId()) {
            $message->set('attempts', 0);
            $message->set('queue', $queue);
            $message->set('id', Resque::generateJobId());
            $message->set('class', static::JOB_CLASS);
            $message->setId($message->getId());
        }

        $delay = $message->getDelay();

        $data = json_decode(json_encode($message), true);

        if ($delay > 0) {
            static::supportDelayed(true);

            \ResqueScheduler::delayedPush(time() + $delay, $data);
        } else {
            Resque::push($queue, $data);
        }

        return $message->getId();
    }
665740
public function publish_async($topic, $message, $qos=0, $retain=0, &$msgid=null)
    {
        # non blocking
        $this->socket->set_non_blocking();

        # set dup 0
        $dup = 0;

        # initial msgid = 0
        $msgid = 0;

        return $this->do_publish($topic, $message, $qos, $retain, $msgid, $dup);
    }
1014921
public function send(string $priority, string $message, array $context = [])
    {
        if (! $this->contextContainsException($context)) {
            $data = [
                'extra' => $this->sanitizer->sanitize($context),
                'level' => $priority,
            ];

            $this->client->captureMessage(
                $message,
                [],
                $data,
                $this->stackTrace->cleanBacktrace(debug_backtrace())
            );

            return;
        }

        /** @var \Exception $exception */
        $exception = $context['exception'];
        unset($context['exception']);

        $exceptionsStack = $this->stackTrace->getExceptions($exception);

        // Adding a first fake exception to log the message
        $stack = $this->stackTrace->cleanBacktrace(debug_backtrace());
        $exceptionsStack[] = [
            'value' => $message,
            'type' => get_class($exception),
            'stacktrace' => [
                'frames' => $this->stackTrace->getStackTraceFrames($stack),
            ],
        ];

        $data = [
            'extra' => $this->sanitizer->sanitize($context),
            'level' => $priority,
            'exception' => [
                'values' => $exceptionsStack,
            ],
        ];

        $this->client->captureMessage($message, [], $data);
    }
110912
public function release(ManagerInterface $manager, $delay = 0, $priority = PheanstalkInterface::DEFAULT_PRIORITY)
    {
        $this->pheanstalk->release($manager->getPheanstalkJob(), $priority, $delay);

        return true;
    }