Returns an instance of this class

@param string $type caching type
@param object $init the IDS_Init object

@return object $this
484225
public static function getInstance($type, $init)
    {
        if (!self::$cachingInstance) {
            self::$cachingInstance = new FileCache($type, $init);
        }

        return self::$cachingInstance;
    }
974100
public static function getInstance($type, $init)
    {

        if (!self::$cachingInstance) {
            self::$cachingInstance = new IDS_Caching_Database($type, $init);
        }
        return self::$cachingInstance;
    }
1162056
public static function getInstance($type, $init)
    {

        if (!self::$cachingInstance) {
            self::$cachingInstance = new SessionCache($type, $init);
        }

        return self::$cachingInstance;
    }
201148
private function load($type)
    {
        $index = $this->$type;
        if ($index) {
            return;
        }

        $cache = $this->di->get("cache");
        $key = $cache->createKey(__CLASS__, $type);
        $index = $cache->get($key);

        if (is_null($index) || $this->ignoreCache) {
            $createMethod = "create$type";
            $index = $this->$createMethod();
            $cache->put($key, $index);
        }

        $this->$type = $index;
    }
1371207
public function create($type, $config)
    {
        $method = $config->get('Cache.DefinitionImpl');
        if ($method === null) {
            return new HTMLPurifier_DefinitionCache_Null($type);
        }
        if (!empty($this->caches[$method][$type])) {
            return $this->caches[$method][$type];
        }
        if (isset($this->implementations[$method]) &&
            class_exists($class = $this->implementations[$method], false)) {
            $cache = new $class($type);
        } else {
            if ($method != 'Serializer') {
                trigger_error("Unrecognized DefinitionCache $method, using Serializer instead", E_USER_WARNING);
            }
            $cache = new HTMLPurifier_DefinitionCache_Serializer($type);
        }
        foreach ($this->decorators as $decorator) {
            $new_cache = $decorator->decorate($cache);
            // prevent infinite recursion in PHP 4
            unset($cache);
            $cache = $new_cache;
        }
        $this->caches[$method][$type] = $cache;
        return $this->caches[$method][$type];
    }
721214
public static function getInstance($type, $init) 
    {

        if (!self::$cachingInstance) {
            self::$cachingInstance = new IDS_Caching_Memcached($type, $init);
        }

        return self::$cachingInstance;
    }
433227
private function setType(string $type): self
    {
        switch ($type) {
            case 'navigator.id.getAssertion': // fall through
            case 'navigator.id.finishEnrollment':
                break;
            default:
                throw new IDE(IDE::MALFORMED_DATA, 'typ');
        }
        $this->typ = $type;
        return $this;
    }
959291
public function get($type)
    {
        if (!isset($this->instances[$type])) {
            $this->instances[$type] = $this->loadFile($type);
        }

        return $this->instances[$type];
    }
1044179
public function flush($type) {
		if (isset($this->cache[$type])) $this->cache[$type]=array();
		return $this;
	}
996981
public static function factory($init, $type) 
    {
        
    	$object  = false;
        $wrapper = preg_replace(
			'/\W+/m', 
			null, 
			ucfirst($init->config['Caching']['caching'])
		);
        $class   = 'IDS_Caching_' . $wrapper;
        $path    = dirname(__FILE__) . DIRECTORY_SEPARATOR . 
            $wrapper . '.php';

        if (file_exists($path)) {
            include_once $path;

            if (class_exists($class)) {
                $object = call_user_func(array($class, 'getInstance'), 
                    $type, $init);
            }
        }

        return $object;
    }
50030
public function create(string $type) : ?Controller
    {
        if (\class_exists($type) === false) {
            return $this->fallthrough($type);
        }

        $ref = new \ReflectionClass($type);
        $ctor = $ref->getConstructor();
        if ($ctor === null || $ctor->getNumberOfParameters() === 0) {
            return new $type();
        }

        return $this->fallthrough($type);
    }
994181
public static function getInstance($type)
	{
		// Sanitize format type.
		$type = strtolower(preg_replace('/[^A-Z0-9_]/i', '', $type));

		// Only instantiate the object if it doesn't already exist.
		if (!isset(self::$instances[$type]))
		{
			$class = '\\Joomla\\Registry\\Format\\' . ucfirst($type);

			if (!class_exists($class))
			{
				throw new \InvalidArgumentException('Unable to load format class.', 500);
			}

			self::$instances[$type] = new $class;
		}

		return self::$instances[$type];
	}
1078679
public static function getInstance($type, $init)
    {
        if (!self::$cachingInstance) {
            self::$cachingInstance = new MemcachedCache($type, $init);
        }

        return self::$cachingInstance;
    }
536514
private function initDefinition($type)
    {
        // quick checks failed, let's create the object
        if ($type == 'HTML') {
            $def = new HTMLPurifier_HTMLDefinition();
        } elseif ($type == 'CSS') {
            $def = new HTMLPurifier_CSSDefinition();
        } elseif ($type == 'URI') {
            $def = new HTMLPurifier_URIDefinition();
        } else {
            throw new HTMLPurifier_Exception(
                "Definition of $type type not supported"
            );
        }
        $this->definitions[$type] = $def;
        return $def;
    }
1095423
public function setType( $type )
    {
        $this->type = is_int( $type ) ? $type : self::getStorableType( $type );
        return $this;
    }
1052983
public function setCacheType($type)
    {
        trigger_error('The '.__METHOD__.' method is deprecated and will be removed in a later version. Use setCache() instead.', E_USER_DEPRECATED);

        if (!defined('\LdapTools\Factory\CacheFactory::TYPE_'.strtoupper($type))) {
            throw new ConfigurationException(sprintf('Unknown cache type "%s".', $type));
        }
        $this->config['cacheType'] = $type;

        return $this;
    }
963361
public static function getCache($type = '') {
        static $caches = [];

        if (!$type) {
            $loader = new ConfigurationLoader();
            $cfg    = $loader->loadConfig('cache');
            $type   = $cfg->get('default', CACHE_TYPE_REDIS);
        }
        if (!isset($caches[ $type ])) {
            if (!isset($cfg)) {
                $loader = new ConfigurationLoader();
                $cfg    = $loader->loadConfig('cache');
            }
            if (!$cfg->getb('enabled')) {
                return new Cache();
            }
            $cache = apply_filter('get_' . $type . '_cache', null, $cfg);
            if (!$cache instanceof Cache) {
                $cache = new Cache ();
            }
            $caches[ $type ] = $cache;
        }

        return $caches[ $type ];
    }