DboSource::cacheMethod PHP Method

cacheMethod() public method

Will retrieve a value from the cache if $value is null. If caching is disabled and a write is attempted, the $value will be returned. A read will either return the value or null.
public cacheMethod ( string $method, string $key, mixed $value = null ) : mixed
$method string Name of the method being cached.
$key string The key name for the cache operation.
$value mixed The value to cache into memory.
return mixed Either null on failure, or the value if its set.
    public function cacheMethod($method, $key, $value = null)
    {
        if ($this->cacheMethods === false) {
            return $value;
        }
        if (!$this->_methodCacheChange && empty(self::$methodCache)) {
            self::$methodCache = Cache::read('method_cache', '_cake_core_');
        }
        if ($value === null) {
            return isset(self::$methodCache[$method][$key]) ? self::$methodCache[$method][$key] : null;
        }
        $this->_methodCacheChange = true;
        return self::$methodCache[$method][$key] = $value;
    }
DboSource