Get a Cache instance by given store name.

@param string|null $name
@return \Core\Services\Contracts\Cache
@throws \InvalidArgumentException
491751
public function store($name = null)
    {
        if (is_null($name)) {
            $name = $this->defaultStore;
        }

        if (isset($this->caches[$name])) {
            return $this->caches[$name];
        }

        $config = config('cache.stores.' . $name);
        if ($config === null) {
            throw new InvalidArgumentException('Cache store "' . $name . '" is not defined.');
        }

        if (!isset($config['driver'])) {
            throw new InvalidArgumentException('Cache driver for store "' . $name . '" is not specified.');
        }

        switch ($config['driver']) {
            case 'APCu':
                $provider = new ApcuCache;
                break;
            case 'Array':
                $provider = new ArrayCache;
                break;
            case 'File':
                $provider = new FilesystemCache($config['path']);
                break;
            case 'Memcached':
                $memcached = new Memcached();
                $memcached->addServer($config['host'], $config['port'], $config['weight']);
                $provider = new MemcachedCache();
                $provider->setMemcached($memcached);
                break;
            case 'Redis':
                $redis = new Redis;
                $redis->connect($config['host'], $config['port'], $config['timeout']);
                $provider = new RedisCache;
                $provider->setRedis($redis);
                break;
            default:
                throw new InvalidArgumentException('Cache driver "' . $config['driver'] . '" is not supported.');
        }

        return $this->caches[$name] = new Cache($provider);
    }
757075
public function getConnectionConfig(string $name = null)
    {
        $name = $name ?: $this->getDefaultConnection();

        $connections = $this->config->get($this->getConfigName().'.connections');

        if (!is_array($config = array_get($connections, $name)) && !$config) {
            throw new InvalidArgumentException("Adapter [$name] not configured.");
        }

        if (is_string($cache = array_get($config, 'cache'))) {
            $config['cache'] = $this->getCacheConfig($cache);
        }

        $config['name'] = $name;

        return $config;
    }
608585
public static function getInstance($name = 'default')
    {
        if (isset(static::$instances[$name])) {
            return static::$instances[$name];
        }

        $instance = new static();

        static::$instances[$name] = $instance;

        return $instance;
    }
704379
public function setDefault($name)
    {
        $name = strtolower($name);

        if (!isset($this->drivers[$name])) {
            throw new InvalidArgumentException(
                "Unregistered cache driver name '$name'"
            );
        }

        $this->default = $name;

        return $this;
    }
992486
public function getByName($name)
    {
        if (!isset($this->nameMap[$name])) {
            return null;
        }

        return $this->get($this->nameMap[$name]);
    }
1137861
public function getRepository($name = null)
    {
        // Resolve repository class name
        $repositoryName = $this->resolveRepositoryClassName($name);

        return new $repositoryName($this->getValidator(), $this->config);
    }
172142
public function getInstanceFromClassName($className, $name)
    {
        if (false === class_exists($className)) {
            throw ClassNotFoundException::wrongFormClassName($className);
        }

        if (false === in_array(FormInterface::class, class_implements($className))) {
            throw InvalidArgumentTypeException::wrongFormType($className);
        }

        $cacheIdentifier = $this->getCacheIdentifier($className, $name);

        if (false === isset($this->instances[$cacheIdentifier])) {
            $cacheInstance = CacheService::get()->getCacheInstance();

            if ($cacheInstance->has($cacheIdentifier)) {
                $instance = $cacheInstance->get($cacheIdentifier);
            } else {
                $instance = $this->createInstance($className, $name);
                $cacheInstance->set($cacheIdentifier, $instance);
            }

            /** @var Configuration $formzConfigurationObject */
            $formzConfigurationObject = $this->configurationFactory
                ->getFormzConfiguration()
                ->getObject(true);

            if (false === $formzConfigurationObject->hasForm($instance->getClassName(), $instance->getName())) {
                $formzConfigurationObject->addForm($instance);
            }

            $this->instances[$cacheIdentifier] = $instance;
        }

        return $this->instances[$cacheIdentifier];
    }
997678
public function get($name)
    {
        $this->checkNameIsString($name);

        if (isset($this->encrypters[$name])) {
            $encrypter = $this->encrypters[$name];
        } else {
            if (isset($this->configs[$name])) {
                $config = $this->configs[$name];
                $encrypter = new ManagedEncrypter($config);

                $this->encrypters[$name] = $encrypter;
            } else {
                throw new \InvalidArgumentException('Unknown encrypter (' . $name . ')');
            }
        }

        return $encrypter;
    }
1295673
public function get($name)
    {
        if (! $this->has($name)) throw new \InvalidArgumentException('no such task');

        $task = new Task($this, $this->getReflection()->getMethod($name . 'Task'));
        return $task;
    }
398954
public function getCacheRule($name = null)
    {
        if (is_null($name)) {
            return $this->cacheRules;
        } else {
            foreach ($this->cacheRules as $r) {
                if ($r->getName() == $name) {
                    return $r;
                }
            }

            return false;
        }
    }
556711
public function get($name)
    {
        if (!isset($this->collectors[$name])) {
            throw new \InvalidArgumentException(\sprintf('Collector "%s" does not exist.', $name));
        }

        return $this->collectors[$name];
    }
962270
public function get($name) {
        N('cache_read',1);
        $name   =   $this->options['prefix'].$name;
        if (xcache_isset($name)) {
            return xcache_get($name);
        }
        return false;
    }
404564
public function getConnection($name = null)
    {
        $name = $name ?: $this->getDefaultConnectionName();

        if (!$this->connectionExists($name)) {
            throw new InvalidArgumentException(sprintf('Doctrine Connection named "%s" does not exist.', $name));
        }

        if (isset($this->connectionsMap[$name])) {
            return $this->connectionsMap[$name];
        }

        return $this->connectionsMap[$name] = $this->getService(
            $this->getConnectionBindingName($this->connections[$name])
        );
    }
287952
public static function instance($name = null)
	{
		if ($name !== null)
		{
			if ( ! array_key_exists($name, static::$_instances))
			{
				return false;
			}

			return static::$_instances[$name];
		}

		if (static::$_instance === null)
		{
			static::$_instance = static::forge();
		}

		return static::$_instance;
	}
492219
public function get($name)
    {
        if (!$this->has($name)) {
            throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
        }

        return $this->helpers[$name];
    }
190938
public static function get($name = null)
    {
        if ($name === null) {
            $name = array_shift(array_keys(self::$containers));
        }
        return self::$containers[$name] ? self::$containers[$name] : null;
    }
754131
public function getRepository($name)
    {
        $storeConfig = $this->config[$name];
        $driver = isset($storeConfig['driver']) ? $storeConfig['driver'] : $name;
        if ($driver instanceof \Closure) {
            $connection = $driver($storeConfig);
        } elseif (method_exists($this, "create" . ucfirst($driver) . 'Store')) {
            $method = "create" . ucfirst($driver) . 'Store';
            $connection = $this->$method($storeConfig);
        } elseif (class_exists($driver)) {
            $connection = new $driver($storeConfig);
        } else {
            throw new \InvalidArgumentException(sprintf(
                'Invalid Cache driver "%s"; must be an defined driver(redis|file) or classname or \Closure',
                $driver
            ));
        }
        return new Repository($connection, $this->config['prefix']);
    }