����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.169 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/././././www/vendor/algolia/algoliasearch-client-php/src/Cache/ |
Upload File : |
<?php
namespace Algolia\AlgoliaSearch\Cache;
use Psr\SimpleCache\CacheInterface;
final class FileCacheDriver implements CacheInterface
{
const PREFIX = 'algolia-client-';
private $directory;
public function __construct($directory)
{
$this->directory = rtrim($directory, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
}
/**
* {@inheritdoc}
*/
public function get($key, $default = null)
{
if (!$this->has($key)) {
return $default;
}
return file_get_contents($this->getFilenameFromKey($key));
}
/**
* {@inheritdoc}
*/
public function set($key, $value, $ttl = null)
{
return file_put_contents($this->getFilenameFromKey($key), $value);
}
/**
* {@inheritdoc}
*/
public function delete($key)
{
return @unlink($this->getFilenameFromKey($key));
}
/**
* {@inheritdoc}
*/
public function clear()
{
$result = true;
foreach (glob($this->directory.self::PREFIX.'*') as $file) {
$result &= @unlink($file);
}
return $result;
}
/**
* {@inheritdoc}
*/
public function getMultiple($keys, $default = null)
{
$result = [];
foreach ($keys as $key) {
$result[$key] = $this->get($key, $default);
}
return $result;
}
/**
* {@inheritdoc}
*/
public function setMultiple($values, $ttl = null)
{
$result = true;
foreach ($values as $key => $value) {
$result &= $this->set($key, $value, $ttl);
}
return $result;
}
/**
* {@inheritdoc}
*/
public function deleteMultiple($keys)
{
$result = true;
foreach ($keys as $key) {
$result &= $this->delete($key);
}
return $result;
}
/**
* {@inheritdoc}
*/
public function has($key)
{
return file_exists($this->getFilenameFromKey($key));
}
/**
* @param string $key
*
* @return string
*/
private function getFilenameFromKey($key)
{
$name = $this->directory.self::PREFIX.$key;
return str_replace('\\', '-', $name);
}
}