Save the compiled cache array.

@param $api        Name of the API.
@param $class      Name of the class.
@param $version    Version of the class.
@param $cacheArray The compiled class cache array.
771839
public function writeCacheFile($api, $class, $version, $cacheArray)
    {
        $this->cacheDriver->save($api, $class, $version, $cacheArray);
    }
614375
private function cacheToArray($cacheMapping)
    {
        $region = isset($cacheMapping['region']) ? (string) $cacheMapping['region'] : null;
        $usage  = isset($cacheMapping['usage']) ? strtoupper($cacheMapping['usage']) : null;

        if ($usage && ! defined('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage)) {
            throw new \InvalidArgumentException(sprintf('Invalid cache usage "%s"', $usage));
        }

        if ($usage) {
            $usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage);
        }

        return array(
            'usage'  => $usage,
            'region' => $region,
        );
    }
196173
public function save(CacheItemInterface $item)
    {
        $key = $item->getKey();

        $this->validateKey($key);

        $this->data[$key] = $item;

        return true;
    }
276142
public function execute($operation, $parameter = array(), $version = null)
    {
        // remove '/' from operation
        $operation = preg_replace('/\//', '', $operation);

        $className = 'RakutenRws_Api_Definition_'.$operation;
        if (!class_exists($className)) {
            throw new LogicException('Operation is not definied.');
        }

        $api = new $className($this, $this->options);
        if ($version !== null) {
            $api->setVersion($version);
        }

        return $api->execute($parameter);
    }
1069953
public function copyToArray(array &$array)
    {
        parent::copyToArray($array);

        $array['serviceApiKey']       = $this->serviceApiKey;
        $array['clientId']            = $this->clientId;
        $array['subject']             = $this->subject;
        $array['latestGrantedScopes'] = $this->latestGrantedScopes;
        $array['mergedGrantedScopes'] = $this->mergedGrantedScopes;
        $array['modifiedAt']          = LanguageUtility::orZero($this->modifiedAt);
    }
1176281
public function copyToArray(array &$array)
    {
        parent::copyToArray($array);

        $array['action']                = LanguageUtility::toString($this->action);
        $array['responseContent']       = $this->responseContent;
        $array['accessToken']           = $this->accessToken;
        $array['accessTokenExpiresAt']  = LanguageUtility::orZero($this->accessTokenExpiresAt);
        $array['accessTokenDuration']   = LanguageUtility::orZero($this->accessTokenDuration);
        $array['refreshToken']          = $this->refreshToken;
        $array['refreshTokenExpiresAt'] = LanguageUtility::orZero($this->refreshTokenExpiresAt);
        $array['refreshTokenDuration']  = LanguageUtility::orZero($this->refreshTokenDuration);
        $array['clientId']              = $this->clientId;
        $array['clientIdAlias']         = $this->clientIdAlias;
        $array['subject']               = $this->subject;
        $array['scopes']                = $this->scopes;
        $array['properties']            = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
    }
644476
private function hydrateArray($array, $group, $version)
    {
        foreach ($array as $key => $value) {
            $this->hydrate($value, $group, $version);
        }

        return $array;
    }
450448
public void saveCache(Object dataKey, String modelClassName, Object model) {
		CacheKey cachKey = cacheKeyFactory.createCacheKey(dataKey.toString(), modelClassName);
		saveToCache(cachKey, model);
	}
135326
public static void initialize(final Class<?> _class)
        throws CacheReloadException
    {
        if (InfinispanCache.get().exists(Status.UUIDCACHE4GRP)) {
            InfinispanCache.get().<UUID, Status>getCache(Status.UUIDCACHE4GRP).clear();
        } else {
            InfinispanCache.get().<UUID, Status>getCache(Status.UUIDCACHE4GRP)
                            .addListener(new CacheLogListener(Status.LOG));
        }
        if (InfinispanCache.get().exists(Status.IDCACHE4STATUS)) {
            InfinispanCache.get().<Long, Status>getCache(Status.IDCACHE4STATUS).clear();
        } else {
            InfinispanCache.get().<Long, Status>getCache(Status.IDCACHE4STATUS)
                            .addListener(new CacheLogListener(Status.LOG));
        }
        if (InfinispanCache.get().exists(Status.NAMECACHE4GRP)) {
            InfinispanCache.get().<String, StatusGroup>getCache(Status.NAMECACHE4GRP).clear();
        } else {
            InfinispanCache.get().<String, StatusGroup>getCache(Status.NAMECACHE4GRP)
                            .addListener(new CacheLogListener(Status.LOG));
        }
    }
731267
public function read($api, $class, $version)
    {
        $cacheFile = $this->getCacheFilename($api, $class, $version);

        if (!file_exists($cacheFile)) {
            throw new RestException('Cache file doesn\'t exist: ' . $cacheFile);
        }

        return include $cacheFile;
    }
1213082
protected function saveToCache()
    {
        if (!is_object($this->dataCache)) {
            throw new Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
        }
        $data = [];
        $propertyNames = [
            'reflectedClassNames',
            'classPropertyNames',
            'classMethodNames',
            'classTagsValues',
            'methodTagsValues',
            'methodParameters',
            'propertyTagsValues',
            'taggedClasses',
            'classSchemata'
        ];
        foreach ($propertyNames as $propertyName) {
            $data[$propertyName] = $this->{$propertyName};
        }
        $this->dataCache->set($this->cacheIdentifier, $data);
        $this->dataCacheNeedsUpdate = false;
    }
590691
private function updateComposerReplacesVersion($version, array $component)
    {
        $composer = $this->rootPath() .'/composer.json';
        if (!file_exists($composer)) {
            throw new \Exception('Invalid composer.json path');
        }

        $data = json_decode(file_get_contents($composer), true);

        $data['replace'][$component['name']] = $version;

        file_put_contents($composer, json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));
    }
36468
def api_call(method, path, params ={}, &proc)
      if cache = caching? && (@cache[cache_key(path, params)])
        return cache
      else
        if @logging
          Calculated::Logging.log_calculated_api(method, path, params) do
            api_call_without_logging(method, path, params, &proc)
          end
        else
          api_call_without_logging(method, path, params, &proc)
        end
      end
    end
1316579
private function cacheVary(
        RequestInterface $request,
        ResponseInterface $response
    ) {
        $key = $this->getVaryKey($request);
        $this->cache->save($key, $this->normalizeVary($response), $this->getTtl($response));
    }
95934
public static function prepopulate_versionnumber_cache($class, $stage, $idList = null)
    {
        ReadingMode::validateStage($stage);
        if (!Config::inst()->get(static::class, 'prepopulate_versionnumber_cache')) {
            return;
        }

        /** @var Versioned|DataObject $singleton */
        $singleton = DataObject::singleton($class);
        $baseClass = $singleton->baseClass();
        $baseTable = $singleton->baseTable();
        $stageTable = $singleton->stageTable($baseTable, $stage);

        $filter = "";
        $parameters = [];
        if ($idList) {
            // Validate the ID list
            foreach ($idList as $id) {
                if (!is_numeric($id)) {
                    user_error(
                        "Bad ID passed to Versioned::prepopulate_versionnumber_cache() in \$idList: " . $id,
                        E_USER_ERROR
                    );
                }
            }
            $filter = 'WHERE "ID" IN (' . DB::placeholders($idList) . ')';
            $parameters = $idList;

        // If we are caching IDs for _all_ records then we can mark this cache as "complete" and in the case of a cache-miss
        // no subsequent call is necessary
        } else {
            self::$cache_versionnumber[$baseClass][$stage] = [ '_complete' => true ];
        }

        $versions = DB::prepared_query("SELECT \"ID\", \"Version\" FROM \"$stageTable\" $filter", $parameters)->map();

        foreach ($versions as $id => $version) {
            self::$cache_versionnumber[$baseClass][$stage][$id] = $version;
        }
    }
1308207
public static function make(string $cacheClassName, array $cacheClassParam = [])
    {
        if (!$cacheClassName) {
            throw new CacheException('name is empty');
        }

        try {
            // check if the class exists or can be loaded
            if (!class_exists($cacheClassName, true)) {
                throw new CacheException('The Cache is not implemented or not installed: ' . $cacheClassName, self::ERROR_CACHE_MISSING, E_USER_ERROR, __FILE__, __LINE__);
            }

            /**
             * @var CacheTrait $cache
             */
            $cache = new $cacheClassName($cacheClassParam);

            if ($cache->isConnected() === false) {
                throw new CacheException('The Cache could not establish connection: ' . $cacheClassName, self::ERROR_CACHE_MISSING, E_USER_ERROR, __FILE__, __LINE__);
            }

        } catch (CacheException $e) {
            throw $e;
        }

        return $cache;
    }
402198
@Override
    public final void process(final Class<?> entityClass, EntityMetadata metadata)
    {

        Cacheable cacheable = (Cacheable) entityClass.getAnnotation(Cacheable.class);

        if (null != cacheable)
        {
            metadata.setCacheable(cacheable.value());
        }
    }