Warms up the cache entities.
167725
public function warm() {
    Timer::start('warm');

    $this->simpleWarmUp();
    $this->traverse();

    $this->logger->info('Cache warmer finish it\'s run in %sec sec.', ['%sec' => Timer::read('warm') / 1000]);
    Timer::stop('warm');
  }
1212986
public function warmUp($cacheDir)
    {
        $templates = array();

        /** @var \Symfony\Component\Templating\TemplateReferenceInterface $template */
        foreach ($this->finder->findAllTemplates() as $template) {
            $templates[$template->getLogicalName()] = $this->locator->locate($template);

            if (!$template instanceof TemplateReference) {
                continue;
            }

            $bundle = $template->get('bundle');
            if (empty($bundle)) {
                continue;
            }
            // Resolve the base bundle
            $bundles = $this->kernel->getBundle($bundle, false);
            $baseBundle = end($bundles);

            // Resolve the base path
            $relativePath = substr($template->getPath(), strlen($bundle) + 1);
            $baseBundlePath = $baseBundle->getPath() . $relativePath;

            // Check if the base is the same if not add the override to the template cache
            if ($templates[$template->getLogicalName()] !== $baseBundlePath) {
                $templates['!'.$template->getLogicalName()] = $baseBundlePath;
            }
        }

        $this->writeCacheFile($cacheDir.'/templates.php', sprintf('<?php return %s;', var_export($templates, true)));
    }
1276230
public function warmUp($cacheDir)
    {
        if ($this->debug) {
            $collectedLogs = [];
            $previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL');
            $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
                if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
                    return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
                }

                if (isset($collectedLogs[$message])) {
                    ++$collectedLogs[$message]['count'];

                    return;
                }

                $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
                // Clean the trace by removing first frames added by the error handler itself.
                for ($i = 0; isset($backtrace[$i]); ++$i) {
                    if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) {
                        $backtrace = \array_slice($backtrace, 1 + $i);
                        break;
                    }
                }

                $collectedLogs[$message] = [
                    'type' => $type,
                    'message' => $message,
                    'file' => $file,
                    'line' => $line,
                    'trace' => $backtrace,
                    'count' => 1,
                ];
            });
        }

        try {
            foreach ($this->warmers as $warmer) {
                if (!$this->optionalsEnabled && $warmer->isOptional()) {
                    continue;
                }
                if ($this->onlyOptionalsEnabled && !$warmer->isOptional()) {
                    continue;
                }

                $warmer->warmUp($cacheDir);
            }
        } finally {
            if ($this->debug && true !== $previousHandler) {
                restore_error_handler();

                if (file_exists($this->deprecationLogsFilepath)) {
                    $previousLogs = unserialize(file_get_contents($this->deprecationLogsFilepath));
                    $collectedLogs = array_merge($previousLogs, $collectedLogs);
                }

                file_put_contents($this->deprecationLogsFilepath, serialize(array_values($collectedLogs)));
            }
        }
    }
283220
private synchronized void initCache() {

    if (this.cache == null) {
      ClasspathFolder rootFolder = new ClasspathFolder(null, "");
      Set<String> resourceNames = this.reflectionUtil.findResourceNames("", true, ConstantFilter.getInstance(true));
      List<ClasspathFile> fileList = new ArrayList<>(resourceNames.size());
      for (String resource : resourceNames) {
        ResourcePathNode<Void> path = ResourcePathNode.create(resource);
        ClasspathFolder parent = createFolderRecursive(path.getParent(), rootFolder);
        ClasspathFile file = new ClasspathFile(parent, path.getName());
        parent.children.add(file);
        fileList.add(file);
      }
      this.cache = new Cache(rootFolder, fileList);
    }
  }
740849
public function cache()
    {
        $this->cache->put(
            $this->getCacheKey(),
            $this->toJson(),
            $this->getCacheLifetime()
        );
    }
752290
def cache_data(self, request, data, key='params'):
        
        request.session['%s:%s' % (constants.SESSION_KEY, key)] = data
910443
private void optimizeStart() {
		if (configuration.isPayloadCache()) {

			if (configuration.getOptimizerStoreClass() == null) {
				store = new CacheOptimizerStore();
				store.start(configuration);
				return;
			}

			try {
				store = (OptimizerStore) Class.forName(configuration.getOptimizerStoreClass()).newInstance();
				store.start(configuration);
			} catch (ClassNotFoundException cnfe) {
				LOGGER.warn("Unable to find the class {}. The payload will be sent without optimizations.", configuration.getOptimizerStoreClass());
			} catch (InstantiationException ex) {
				LOGGER.warn("Unable to instantiate the class {}. Concrete class required.", configuration.getOptimizerStoreClass());
			} catch (IllegalAccessException ex) {
				LOGGER.warn("Unable to instantiate the class {}. Empty constructor required.", configuration.getOptimizerStoreClass());
			}
		}
	}
1139306
public function refresh()
    {
        $this->removeCache();

        /** @var RefreshCacheEvent $event */
        $event = $this->eventDispatcher->dispatch('refresh_cache', RefreshCacheEvent::class);

        $this->writeCache($event->getParameters());
    }
831456
public function warm(Parameter $param) : void
    {
        $velocity = get_class($param->w())::zeros(...$param->w()->shape());
        $g2 = clone $velocity;

        $this->cache[$param->id()] = [$velocity, $g2];
    }
192233
def warmup(f):
    

    @wraps(f)
    def wrapped(self, *args, **kwargs):
        if not self.warmed_up:
            self.warmup()
        return f(self, *args, **kwargs)
    return wrapped
339714
public function warmupAction()
    {
        $request    = $this->getRequest();
        $purge      = $request->getParam('purge', false);
        $verbose    = $request->getParam('verbose', false) || $request->getParam('v', false);

        // purge cache for every configuration
        if ($purge) {
            $this->purgeCache($verbose);
        }

        $this->output('Collecting all assets...', $verbose);

        $collection = $this->assetManager->getResolver()->collect();
        $this->output(sprintf('Collected %d assets, warming up...', count($collection)), $verbose);

        foreach ($collection as $path) {
            $asset = $this->assetManager->getResolver()->resolve($path);
            $this->assetManager->getAssetFilterManager()->setFilters($path, $asset);
            $this->assetManager->getAssetCacheManager()->setCache($path, $asset)->dump();
        }

        $this->output(sprintf('Warming up finished...', $verbose));
    }
140464
public function warmUp($cacheDir)
    {

        $fs = new FileSystem();
        $fs->dumpFile($this->cacheDir . '/swagger/swagger.json', $this->swaggerBuilder->buildSwagger());
    }
287070
public function warmUp($cacheDir)
    {
        $mustache = $this->container->get('mustache');

        foreach ($this->finder->findAllTemplates() as $template) {
            if ('mustache' !== $template->get('engine')) {
                continue;
            }

            try {
                $mustache->loadTemplate((string) $template);
            } catch (\Exception $e) {
                // problem during compilation, give up
            }
        }
    }
1259768
public function load(): void
    {
        try {
            $keys = $this->cache->get(self::INDEXING_KEY);
            if ($keys instanceof Keys) {
                $this->keys = $keys;
                return;
            }
        } catch (CacheException $e) {
            trigger_error($e->getMessage(), E_USER_WARNING);
        }

        $this->keys = new Keys();
    }
461912
public void onStartup() {
        try {
            preloadCaches();
            SpringAppContext.getInstance().loadPackageContexts();  // trigger dynamic context loading
            preloadDynamicCaches();
            // implementor cache relies on kotlin from preloadDynamicCaches()
            ImplementorCache implementorCache = new ImplementorCache();
            implementorCache.loadCache();
            allCaches.put(ImplementorCache.class.getSimpleName(), implementorCache);
        }
        catch (Exception ex){
            String message = "Failed to load caches";
            logger.severeException(message, ex);
            throw new StartupException(message, ex);
        }
    }
427741
def prepare(self, cache):
        """"""
        if cache is not None:
            np.copyto(self.qubits, cache)
        else:
            self.qubits.fill(0.0)
            self.qubits[0] = 1.0
        self.cregs = [0] * self.n_qubits
519483
private function _populate_cache()
    {
        if ($this->_use_json) {
            if (is_readable($this->_cache_file) &&
            ($loaded = @json_decode(Common::getContents($this->_cache_file, ''), true)) && is_array($loaded)) {
                $this->_existing_cache_vals = $loaded;
            }
        } else {
            if (is_readable($this->_cache_file) &&
            ($loaded = @unserialize(Common::getContents($this->_cache_file, false))) && is_array($loaded)) {
                $this->_existing_cache_vals = $loaded;
            }
        }
    }