Loads container from cache if available, otherwise
create the container from scratch.
497247
private function initializeContainer()
    {
        $cacheFilePath = $this::getCacheFilePath();

        if (file_exists($cacheFilePath)) {
            $this->loadContainerFromCache($cacheFilePath);
        } else {
            $this->getCompiledSymfonyContainer();
            $this->saveContainerToCache($cacheFilePath);
        }
    }
1219187
private <T> T loadDataFromCache(final Class<T> clazz, final Object cacheKey, final long maxTimeInCacheBeforeExpiry) throws CacheLoadingException, CacheCreationException {
        return cacheManager.loadDataFromCache(clazz, cacheKey, maxTimeInCacheBeforeExpiry);
    }
828542
private void init()
    {
        this.container = InfinispanCache.findCacheContainer();
        if (this.container == null) {
            try {
                this.container = new DefaultCacheManager(this.getClass().getResourceAsStream(
                                "/org/efaps/util/cache/infinispan-config.xml"));
                if (this.container instanceof EmbeddedCacheManager) {
                    this.container.addListener(new CacheLogListener(InfinispanCache.LOG));
                }
                InfinispanCache.bindCacheContainer(this.container);
                final Cache<String, Integer> cache = this.container
                                .<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
                cache.put(InfinispanCache.COUNTERCACHE, 1);
            } catch (final FactoryConfigurationError e) {
                InfinispanCache.LOG.error("FactoryConfigurationError", e);
            } catch (final IOException e) {
                InfinispanCache.LOG.error("IOException", e);
            }
        } else {
            final Cache<String, Integer> cache = this.container
                            .<String, Integer>getCache(InfinispanCache.COUNTERCACHE);
            Integer count = cache.get(InfinispanCache.COUNTERCACHE);
            if (count == null) {
                count = 1;
            } else {
                count = count + 1;
            }
            cache.put(InfinispanCache.COUNTERCACHE, count);
        }
    }
283280
protected function initializeContainer()
    {
        $class = $this->getContainerClass();
        $cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug);
        $fresh = true;
        if (!$cache->isFresh()) {
            $container = $this->buildContainer();
            $container->compile();
            $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass());

            $fresh = false;
        }

        require_once $cache->getPath();

        $this->container = new $class();
        $this->container->set('kernel', $this);

        if (!$fresh && $this->container->has('cache_warmer')) {
            $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir'));
        }
    }
257296
public function initialize()
    {
        Facade::setContainer($this->container);

        if (null !== $loader = $this->loader) {
            $loader->register();
        }
    }
83705
protected function initialiseContainer()
    {
        // @todo: add some form of container caching?
        $container = $this->buildContainer();
        $this->prepareContainer($container);

        $this->container = $container;
        return $this->container;
    }
1068569
private function load()
    {
        if (!$this->loaded && isset($this->storage)) {
            $this->data = $this->storage->load($this->id);
            $this->original = $this->data;
            $this->loaded = true;
        }
    }
492815
def start(name, config_file=None):
    '''
    
    '''
    if not exists(name):
        raise ContainerNotExists("The container (%s) does not exist!" % name)
    if name in running():
        raise ContainerAlreadyRunning('The container %s is already started!' % name)
    cmd = ['lxc-start', '-n', name, '-d']
    if config_file:
        cmd += ['-f', config_file]
    subprocess.check_call(cmd)
697781
public static function setup()
    {
        if (static::$setup === false) {
            try {
                static::create_container();
                static::init_config();
                static::init_routing();
                static::init_services();
                static::add_wordpress_globals();

                // Run the loader.
                $loader = new Loader();
                $loader->boot();

                static::register_providers();
                static::init_templating();

                static::init_view();

                $classmap = null;
                $classmap_cache = \get_stylesheet_directory() . '/cache/config/' . \sha1(NONCE_SALT . 'classmap');

                if (WP_DEBUG === false && \file_exists($classmap_cache)) {
                    $classmap = \file_get_contents($classmap_cache);
                }

                $loader->load_theme($classmap);
            } catch (Exception $e) {
                throw new Startup_Exception($e->getMessage());
            }
        }

        static::$setup = true;
    }
933570
def _load_from_cache_if_available(self, key):
    
    if key in self._cache:
      entity = self._cache[key]  # May be None, meaning "doesn't exist".
      if entity is None or entity._key == key:
        # If entity's key didn't change later, it is ok.
        # See issue 13.  http://goo.gl/jxjOP
        raise tasklets.Return(entity)
611388
protected function initialize(): void
	{
		// Create container instance and register it in itself so that it can be injected

		$this->container = $this->containerFactory();

		$this->container->registerInstance([Container::class, 'container'], $this->container);

		// Register self so that the application instance can be injected

		$this->container->registerInstance([Application::class, 'app'], $this);

		// Register file system instance

		$this->container->registerInstance([FileSystem::class, 'fileSystem'], new FileSystem);

		// Register config instance

		$this->config = $this->configFactory();

		$this->container->registerInstance([Config::class, 'config'], $this->config);
	}
1163963
def from_prefix(cls, container, prefix):
        """"""
        if prefix is None:
            raise errors.NoObjectException

        return cls(container,
                   name=prefix.name,
                   obj_type=cls.type_cls.SUBDIR)
246215
def _load(self, **kwargs):
        '''
        '''
        # Some kwargs should be popped before we do a load
        for key in self._meta_data['disallowed_load_parameters']:
            if key in kwargs:
                kwargs.pop(key)

        self._check_load_parameters(**kwargs)
        name = kwargs.pop('name', '')
        partition = kwargs.pop('partition', '')
        read_session = self._meta_data['icr_session']
        base_uri = self._meta_data['container']._meta_data['uri']

        load_uri = self._build_service_uri(base_uri, partition, name)
        response = read_session.get(load_uri, uri_as_parts=False, **kwargs)
        return self._produce_instance(response)
1064974
protected function initializeContainer()
    {
        $this->container = $this->buildContainer();
        $this->container->set('kernel', $this);
        if ( ! $this->testCase->isContainerManuallyCompiled()) {
            $this->container->compile();
        }
    }
1366926
protected function buildContainer()
    {
        foreach (['cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()] as $name => $dir) {
            if (!is_dir($dir)) {
                if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
                    throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir));
                }
            } elseif (!is_writable($dir)) {
                throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir));
            }
        }

        $container = $this->getContainerBuilder();
        $container->addObjectResource($this);
        $this->prepareContainer($container);

        if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) {
            $container->merge($cont);
        }

        $container->addCompilerPass(new AddAnnotatedClassesToCachePass($this));

        return $container;
    }
253369
def add_to(self, container):
        '''
        
        '''
        if self.container:
            self.remove_from(self.container)
        container.add(self)
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;
            }
        }
    }