-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
269 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
namespace support; | ||
|
||
use Symfony\Component\Cache\Adapter\RedisAdapter; | ||
use Symfony\Component\Cache\Psr16Cache; | ||
|
||
/** | ||
* Class Cache | ||
* @package support\bootstrap | ||
* | ||
* Strings methods | ||
* @method static mixed get($key, $default = null) | ||
* @method static bool set($key, $value, $ttl = null) | ||
* @method static bool delete($key) | ||
* @method static bool clear() | ||
* @method static iterable getMultiple($keys, $default = null) | ||
* @method static bool setMultiple($values, $ttl = null) | ||
* @method static bool deleteMultiple($keys) | ||
* @method static bool has($key) | ||
*/ | ||
class Cache | ||
{ | ||
/** | ||
* @var Psr16Cache | ||
*/ | ||
public static $_instance = null; | ||
|
||
/** | ||
* @return Psr16Cache | ||
*/ | ||
public static function instance() | ||
{ | ||
if (!static::$_instance) { | ||
$adapter = new RedisAdapter(Redis::connection()->client()); | ||
self::$_instance = new Psr16Cache($adapter); | ||
} | ||
return static::$_instance; | ||
} | ||
|
||
/** | ||
* @param $name | ||
* @param $arguments | ||
* @return mixed | ||
*/ | ||
public static function __callStatic($name, $arguments) | ||
{ | ||
return static::instance()->{$name}(... $arguments); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.