Enables or disables caching of class instances.

@param boolean $value True to enable caching, false to disable it.
@return boolean Previous cache setting
554706
static public function setCache( $value )
	{
		$old = self::$cache;
		self::$cache = (boolean) $value;

		return $old;
	}
699454
public function remove($value)
    {
        $hash = self::hash($value);
        if(array_key_exists($hash, $this->objects)) {
            unset($this->objects[$hash]);
            return true;
        }
        return false;
    }
287299
private function hasMap($value)
    {
        $class = $this->getClassName($value);

        return isset($this->loadedClasses[$class]) || $this->loader->hasMetadata($class);
    }
241868
public function setSharedMaxAge($value)
    {
        $this->addCacheControlDirective('public');
        $this->removeCacheControlDirective('private');
        $this->addCacheControlDirective('s-maxage', $value);

        return $this;
    }
204344
public function set($value)
    {
        return (
            ($this->value = $this->clean($value, true, false)) &&
            ($this->rawValue = $value)
        );
    }
1363258
public function setCoreCacheActionMap($value)
    {
        $this->setFieldName('cache_action_map');
        $this->loadObject(true);
        $this->setFieldValue($value);

        return $this;
    }
1248621
public function setCoreEnableGravatar($value)
    {
        $this->setFieldName('enable_gravatar');
        $this->loadObject(true);
        $this->setFieldValue($value);

        return $this;
    }
641626
public static function set($cacheName, $value = null, $option = array(), $alias = null)
	{
		$obj = self::getInstance($alias);
		if ($obj)
		{
			return $obj->set($cacheName, $value, $option);
		}
		else
		{
			return false;
		}
	}
707452
public function setCache($key, $value) {
        $this->_cache[$this->createCacheKey($key)] = $value;

        return $value;
    }
423476
protected function isValidCache($value): bool
    {
        $result = false;

        $parentResult = parent::isValidCache($value);
        if ($parentResult === false) {
            return $result;
        }

        $path = array_key_exists('path', $value) ? $value['path'] : '';
        try {
            Utility::validatePath($path);
        } catch (InvalidArgumentException $e) {
            $this->errors[] = "Path does not exist or is not readable: $path";

            return $result;
        }

        $md5 = array_key_exists('md5', $value) ? $value['md5'] : '';
        $content = (string)file_get_contents($value['path']);
        if (md5($content) <> $md5) {
            $this->warnings[] = 'Stale cache found. Cleaning up and ignoring';

            return $result;
        }

        $result = true;

        return $result;
    }
153910
protected function parseIsRefreshGrantEnabled(string $value): Client
    {
        $value === '1' ? $this->enableRefreshGrant() : $this->disableRefreshGrant();

        return $this;
    }
977343
protected function cache($key, $value = null)
    {
        if (is_null($value) && $this->cacheHas($key)) {
            array_forget($this->cache, $key);
            return null;
        }

        if (is_null($value)) {
            return array_get($this->cache, $key, false);
        }

        if (! is_bool($value)) {
            $value  =   false;
        }

        array_set($this->cache, $key, $value);

        return $value;
    }
318165
public function set( $name, $value )
	{
		$name = trim( $name, '/' );

		if( $value !== null )
		{
			$this->_cache[ $name ] = $value;

			if( isset( $this->_negCache[ $name ] ) ) {
				unset( $this->_negCache[ $name ] );
			}
		}
		else
		{
			$this->_negCache[ $name ] = true;
		}

		$this->_getObject()->set( $name, $value );
	}
479022
public function cacheSet($key, $value)
    {
        return $this->cache() ? $this->cache()->set($key, $value) : null;
    }
1309227
protected function validCache($value)
    {
        if (is_null($value) || !is_array($value) || empty($value)) {
            return false;
        }

        return true;
    }
1273927
protected function loadGlobals($value) {
        $enabled = false;                                           // default
        if (is_bool($value) || is_int($value)) {
            $enabled = (bool) $value;
        }
        elseif (is_string($value)) {
            $value   = trim(strtolower($value));
            $enabled = ($value=='1' || $value=='on' || $value=='true');
        }
        if ($enabled && !function_exists('booltostr')) {            // prevent multiple includes
            include(MINISTRUTS_ROOT.'/src/globals.php');
        }
    }
151784
public function lock( $value = true )
	{
		$this->lock = $value;

		if ( $this->lock )
		{
			$this->useWritePdo();
		}

		return $this;
	}