for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Suven\FlintRedis;
abstract class FlintRedisCacheFactory
{
const STRATEGY_REDIS = 1;
const STRATEGY_FLINTSTONE = 2;
private static $cachedInstances = [];
/**
* @var number Either FlintRedisCacheFactory::STRATEGY_REDIS or FlintRedisCacheFactory:: STRATEGY_FLINTSTONE
*/
public static $strategy = self::STRATEGY_REDIS;
* @var array Options you want to pass to predis/flintstone
public static $options = [];
* Retrieves a new or previously created cache-instance for the provided
* parameters.
*
* @param string $realm Your collections name
* @return FlintRedisCache
public static function create($realm, $strategy = false, $options = false)
$instance = self::retrieveOldInstance($realm);
if ($strategy) {
self::$strategy = $strategy;
$strategy
boolean
integer|double
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
}
if ($options) {
self::$options = $options;
$options
array
if (!$instance) {
$instance = self::newCacheInstance($realm);
return $instance;
private static function retrieveOldInstance($realm)
return isset(self::$cachedInstances[$realm]) ? self::$cachedInstances[$realm] : false;
private static function newCacheInstance($realm)
if (self::$strategy === self::STRATEGY_REDIS) {
self::$cachedInstances[$realm] = new FlintRedisCacheRedis($realm, self::$options);
} else {
self::$cachedInstances[$realm] = new FlintRedisCacheFlintstone($realm, self::$options);
return self::$cachedInstances[$realm];
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..