Force Propel boot before cache warmup
507055
protected function propelInit()
    {
        if (!\Propel::isInit()) {
            \Propel::setConfiguration($this->container->get('propel.configuration'));
            \Propel::initialize();
        }
    }
798971
protected function setupFacades()
    {
        // Setup alias loader.
        $loader = AliasLoader::getInstance();

        // Load Sentinel
        // - Activation
        // - Reminder
        // - Sentinel
        $loader->alias('Activation', Activation::class);
        $loader->alias('Reminder', Reminder::class);
        $loader->alias('Sentinel', Sentinel::class);

        // Load Flash
        $loader->alias('Flash', Flash::class);

        // Load Ekko
        $loader->alias('Ekko', Ekko::class);

        // Carbon
        $loader->alias('Carbon', Carbon::class);

        // Load Form
        // - Form
        // - BootForm
        $loader->alias('Form', Form::class);
        $loader->alias('BootForm', BootForm::class);
    }
1284424
public function boot()
    {
        $this->package('intervention/image');

        // try to create imagecache route only if imagecache is present
        if (class_exists('Intervention\\Image\\ImageCache')) {

            $app = $this->app;

            // load imagecache config
            $app['config']->package('intervention/imagecache', __DIR__.'/../../../../imagecache/src/config', 'imagecache');
            $config = $app['config'];

            // create dynamic manipulation route
            if (is_string($config->get('imagecache::route'))) {

                // add original to route templates
                $config->set('imagecache::templates.original', null);

                // setup image manipulator route
                $app['router']->get($config->get('imagecache::route').'/{template}/{filename}', ['as' => 'imagecache', function ($template, $filename) use ($app, $config) {

                    // disable session cookies for image route
                    $app['config']->set('session.driver', 'array');

                    // find file
                    foreach ($config->get('imagecache::paths') as $path) {
                        // don't allow '..' in filenames
                        $image_path = $path.'/'.str_replace('..', '', $filename);
                        if (file_exists($image_path) && is_file($image_path)) {
                            break;
                        } else {
                            $image_path = false;
                        }
                    }

                    // abort if file not found
                    if ($image_path === false) {
                        $app->abort(404);
                    }

                    // define template callback
                    $callback = $config->get("imagecache::templates.{$template}");

                    if (is_callable($callback) || class_exists($callback)) {

                        // image manipulation based on callback
                        $content = $app['image']->cache(function ($image) use ($image_path, $callback) {
                            
                            switch (true) {
                                case is_callable($callback):
                                    return $callback($image->make($image_path));
                                    break;
                                
                                case class_exists($callback):
                                    return $image->make($image_path)->filter(new $callback);
                                    break;
                            }

                        }, $config->get('imagecache::lifetime'));

                    } else {

                        // get original image file contents
                        $content = file_get_contents($image_path);
                    }

                    // define mime type
                    $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $content);

                    // return http response
                    return new IlluminateResponse($content, 200, [
                        'Content-Type' => $mime,
                        'Cache-Control' => 'max-age='.($config->get('imagecache::lifetime')*60).', public',
                        'Etag' => md5($content)
                    ]);

                }])->where(['template' => join('|', array_keys($config->get('imagecache::templates'))), 'filename' => '[ \w\\.\\/\\-]+']);
            }
        }
    }
205253
public static function boot()
    {
        Cache::extend('opcache', function () {
            $store = new Store;
            return new Repository($store, new TagSet($store));
        });

        // Extend Collection to implement __set_state magic method
        if (! Collection::hasMacro('__set_state')) {
            Collection::macro('__set_state', function (array $array) {
                return new Collection($array['items']);
            });
        }
    }
518217
private void bootstrap() {
    List<MemberId> activePeers = bootstrapPeersSupplier.get();
    if (activePeers.isEmpty()) {
      return;
    }
    try {
      requestBootstrapFromPeers(activePeers)
          .get(DistributedPrimitive.DEFAULT_OPERATION_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
    } catch (ExecutionException | InterruptedException | TimeoutException e) {
      LOGGER.debug("Failed to bootstrap ec map {}: {}", mapName, ExceptionUtils.getStackTrace(e));
    }
  }
345695
public function init($no_cache = false)
    {
        $this->bootCacher();

        // From local cache
        if (self::$_cached_settings && is_array(self::$_cached_settings) && !$no_cache) {
            return self::$_cached_settings;
        }

        if ($no_cache) {
            // Force cache invalidation
            self::$_cached_settings = [];
        } else {
            // Get from cache
            self::$_cached_settings = Cacher::getInstance()->getDefaultCacher()->get(self::CACHE_KEY);
        }

        if (!self::$_cached_settings && SQL::getInstance()->tableExists('cms_settings')) {
            // Get from DB
            $settings_collection = new SettingEntityRepository();
            self::$_cached_settings = $settings_collection->getPairs('value', 'name');
            Cacher::getInstance()->getDefaultCacher()->set(self::CACHE_KEY, self::$_cached_settings);
        }

        if (!is_array(self::$_cached_settings)) {
            self::$_cached_settings = [];
        }

        return self::$_cached_settings;
    }
974516
public function boot()
    {
        // Helpers
        require_once __DIR__.DIRECTORY_SEPARATOR.'helpers.php';

        // Load views
        $this->loadViewsFrom(__DIR__.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'views', 'cornerstone');

        // Load translations
        $this->loadTranslationsFrom(__DIR__.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'lang', 'cornerstone');

        // Load routes
        $this->loadRoutesFrom(__DIR__.DIRECTORY_SEPARATOR.'Http'.DIRECTORY_SEPARATOR.'routes.php');

        // View Composer
        Container::getInstance()->make(ViewFactory::class)->composer('*', ViewComposerServiceProvider::class);
    }
662165
protected function prepareCacheStore()
    {
        if ($this->retrieve('expires') != $this->throttle->getExpires()) {
            $this->forget('requests');
            $this->forget('expires');
            $this->forget('reset');
        }
    }
1190949
def boot(self, name, flavor_id=0, image_id=0, timeout=300, **kwargs):
        '''
        
        '''
        nt_ks = self.compute_conn
        kwargs['name'] = name
        kwargs['flavor'] = flavor_id
        kwargs['image'] = image_id or None
        ephemeral = kwargs.pop('ephemeral', [])
        block_device = kwargs.pop('block_device', [])
        boot_volume = kwargs.pop('boot_volume', None)
        snapshot = kwargs.pop('snapshot', None)
        swap = kwargs.pop('swap', None)
        kwargs['block_device_mapping_v2'] = _parse_block_device_mapping_v2(
            block_device=block_device, boot_volume=boot_volume, snapshot=snapshot,
            ephemeral=ephemeral, swap=swap
        )
        response = nt_ks.servers.create(**kwargs)
        self.uuid = response.id
        self.password = getattr(response, 'adminPass', None)

        start = time.time()
        trycount = 0
        while True:
            trycount += 1
            try:
                return self.server_show_libcloud(self.uuid)
            except Exception as exc:
                log.debug(
                    'Server information not yet available: %s', exc
                )
                time.sleep(1)
                if time.time() - start > timeout:
                    log.error('Timed out after %s seconds '
                              'while waiting for data', timeout)
                    return False

                log.debug(
                    'Retrying server_show() (try %s)', trycount
                )
251913
protected function prepareEnvironment()
    {
        // Bind command to container
        $this->container->add('command', $this);

        // Set active connections from flag
        if ($connections = $this->command->option('on')) {
            $this->connections->setActiveConnections($connections);
        }

        // Install and load plugins if not setup already
        $vendor = $this->paths->getRocketeerPath().DS.'vendor';
        if (!$this->files->has($vendor)) {
            $this->queue->execute(Installer::class);
            $this->bootstrapper->bootstrapRocketeerDependencies();
            $this->bootstrapper->bootstrapUserCode();
        }
    }
511531
protected function _boot() {

			// Start the session
			session_start();

			// Create local inflector
			static::$inflector = Inflector::instance();

			// Create configuration
			$this->_configure();

			// Configure session :)
			session_set_cookie_params($this->config->sessionCookieExpireTime);
			if ($this->config->sessionRegenerateId) {
				session_regenerate_id();
			}
			
			// Apply Application's namespace
			AutoLoad::autoLoadNamespace($this->config->applicationNamespace, APP_PATH);

			// Auto load modules?
			if ($this->config->autoLoadModules == true) {
				$this->_loadModules();
			}

			// Create request
			$this->_request = new Request();
			
			// Check if static file exists?
			if ($this->config->staticThroughChickenWire && $this->_request->rawUri != '') {
			
				// In application?
				$filename = PUBLIC_PATH . $this->_request->rawUri;
				if (file_exists($filename)) {
					
					// Mime available?
					$mime = Mime::byFile($filename);
					
					// Send header
					Http::sendMimeType($mime);
					echo file_get_contents($filename);
					die;

				}

				// In modules
				foreach (Module::all() as $module) {

					// In this module?
					$regex = '/^' . preg_quote($module->urlPrefix, '/') . '\/(?<url>.+)$/';
					if (preg_match($regex, $this->_request->rawUri, $matches)) {

						// Does the file exist?
						$filename = $module->path . "/Public/" . $matches['url'];
						if (file_exists($filename)) {
							
							// Mime available?
							$mime = Mime::byFile($filename);
							
							// Send header
							Http::sendMimeType($mime);
							echo file_get_contents($filename);
							die;

						}

					} 

				}

			}

			// Try to route!
			$this->_matchRoute();

		}
657991
function warnLooseParamsCacheDeprecation (params) {
  if (params.ttl || params.cacheKey || params.staleWhileRevalidate) {
    module.exports.looseCacheParamsDeprecationWarning()
  }
}
476639
public function warmUp($cacheDir)
    {
        $iterator = new ResourceFilterIterator(
            new RecursiveResourceIteratorIterator(
                new ResourceCollectionIterator(
                    $this->repo->get('/')->listChildren(),
                    ResourceCollectionIterator::CURRENT_AS_PATH
                ),
                RecursiveResourceIteratorIterator::SELF_FIRST
            ),
            $this->suffix,
            ResourceFilterIterator::FILTER_BY_NAME | ResourceFilterIterator::MATCH_SUFFIX
        );

        foreach ($iterator as $path) {
            try {
                $this->twig->loadTemplate($path);
            } catch (Twig_Error $e) {
                // Problem during compilation, stop
            }
        }
    }
701969
def apply(self, reboot=False):
        """"""
        self.root.use_virtual_addresses = True
        self.root.manage.manage = True
        self.root.mode = 'new'
        self.root.init_boot = reboot

        self.client.set_profile(self.root.get_json())
967589
private void setInitializeAtStartup(Boolean flag) {
        this.initializeAtStartup = flag;
        setProperty(Constants.SSLPROP_KEY_STORE_INITIALIZE_AT_STARTUP, flag.toString());
    }
1156044
public function bootstrap()
    {

        // Start the rudimental system
        try {

            // Load settingsfile
            $this->loadSettings();

            // From here starts output buffering
            ob_start();

            // Registe PSR classloader
            $this->registerClassloader();

            // Create core DI container instance and map the instance to comntainer
            $this->di = \Core\DI\DI::getInstance();
            $this->di->mapValue('core.di', $this->di);

            $this->initLogger();

            // Run inits
            $this->initDatabase();
            $this->initMessageHandler();
            $this->initDependencies();
            $this->initHttp();
            $this->initSession();
            $this->initConfig();
            $this->initMailer();
            $this->initRouter();

            // Get an instance of Core app
            $this->getAppInstance('Core');

            $this->initSecurity();
            $this->initPage();
            $this->initAssetManager();

            // Run highlevel system
            $this->autodiscoverApps();

            // Match request against the generic routes to get the ajax request flag and to match a fallback result.
            $this->router->match();

            // Initiate apps
            $this->initApps();

            // Match routes again as now possible app routes are available
            $this->router->match();

            // Run dispatcher
            $result = $this->dispatch();

            // Send mails
            $this->mailer->send();

            // Process all assets
            $this->processAssets();

            // Send cookies
            $this->http->cookies->send();

            // Redirect requested?
            if (!empty($_SESSION['Core']['redirect'])) {

                $this->http->header->location($_SESSION['Core']['redirect']['location'], $_SESSION['Core']['redirect']['permanent']);
                $this->http->header->send();

                // Important: Clear redirect from session!
                unset($_SESSION['Core']['redirect']);

                return;
            }

            switch ($this->router->getFormat()) {

                case 'file':
                    $sendfile = new Sendfile($result);
                    $sendfile->send();

                    break;

                case 'html':

                    $this->http->header->contentType('text/html', 'utf-8');

                    $language = $this->getAppInstance('Core')->language;

                    // Add logoff button for logged in users
                    if ($this->user->isGuest()) {
                        $this->page->menu->createItem('register', $language->get('menu.register'), $this->router->generate('core.register'));
                        $this->page->menu->createItem('login', $language->get('menu.login'), $this->router->generate('core.login', [
                            'action' => 'login'
                        ]));
                    }

                    // or add login and register buttons. But not when current user is currently on banlist
                    else {

                        $usermenu = $this->page->menu->createItem('login', $this->user->getDisplayname());

                        // Show admin menu?
                        if ($this->user->getAdmin()) {
                            $usermenu->createItem('admin', $language->get('menu.admin'), $this->router->generate('core.admin'));
                        }

                        $usermenu->createItem('logout', $language->get('menu.logout'), $this->router->generate('core.login', [
                            'action' => 'logout'
                        ]));
                    }

                    $this->page->setHome($this->config->get('Core', 'url.home'));
                    $this->page->setContent($result);

                    $result = $this->page->render();
            }

            // Send headers so far
            $this->http->header->send();
        }
        catch (\Throwable $t) {

            $error = new ErrorHandler($t);
            $error->setAjax(isset($_REQUEST['ajax']));
            $error->setPublic(isset($this->user) && $this->user->getAdmin());
            $error->setPublic(true);

            if (isset($this->logger)) {
                $error->setLogger($this->logger);
            }

            http_response_code(500);

            $result = $error->handle();
        }

        echo $result;

        ob_end_flush();
    }
813292
function setupCache (config = {}) {
  // Extend default configuration
  config = makeConfig(config)

  // Axios adapter. Receives the axios request configuration as only parameter
  async function adapter (req) {
    // Merge the per-request config with the instance config.
    const reqConfig = mergeRequestConfig(config, req)

    // Execute request against local cache
    let res = await request(reqConfig, req)
    let next = res.next

    // Response is not function, something was in cache, return it
    if (!isFunction(next)) return next

    // Nothing in cache so we execute the default adapter or any given adapter
    // Will throw if the request has a status different than 2xx
    let networkError

    try {
      res = await reqConfig.adapter(req)
    } catch (err) {
      networkError = err
    }

    if (networkError) {
      // Check if we should attempt reading stale cache data
      let readOnError = isFunction(reqConfig.readOnError)
        ? reqConfig.readOnError(networkError, req)
        : reqConfig.readOnError

      if (readOnError) {
        try {
          // Force cache tu return stale data
          reqConfig.acceptStale = true

          // Try to read from cache again
          res = await request(reqConfig, req)

          // Signal that data is from stale cache
          res.next.request.stale = true

          // No need to check if `next` is a function just return cache data
          return res.next
        } catch (cacheReadError) {
          // Failed to read stale cache, do nothing here, just let the network error be thrown
        }
      }

      // Re-throw error so that it can be caught in userland if we didn't find any stale cache to read
      throw networkError
    }

    // Process response to store in cache
    return next(res)
  }

  // Return adapter and store instance
  return {
    adapter,
    config,
    store: config.store
  }
}