Initialises the cache.

Once this has been done the cache is all set to be used.

@param cache_definition $definition
550775
public function initialise(cache_definition $definition) {
        $this->storeid = $definition->generate_definition_hash();
        $this->store = &self::register_store_id($this->name.'-'.$definition->get_id());
        $this->ttl = $definition->get_ttl();
        $maxsize = $definition->get_maxsize();
        if ($maxsize !== null) {
            // Must be a positive int.
            $this->maxsize = abs((int)$maxsize);
            $this->storecount = count($this->store);
        }
        $this->check_ttl();
    }
554933
public function init()
    {
        if ($this->getCache() === null) {
            $options = $this->getOptions();
            $this->setCache(Cache\StorageFactory::factory($options['cache']));
        }

        $this->isInit = true;
    }
257080
public static void initialize()
    {
        if (InfinispanCache.get().exists(DBProperties.CACHENAME)) {
            InfinispanCache.get().<String, String>getCache(DBProperties.CACHENAME).clear();
        } else {
            InfinispanCache.get().<String, String>getCache(DBProperties.CACHENAME)
                            .addListener(new CacheLogListener(DBProperties.LOG));
        }
        DBProperties.cacheOnStart();
    }
710297
def _cache_init(self):
        """"""
        cache_ = cache.get(self.CACHE_KEY)
        if cache_ is None:
            cache_ = defaultdict(dict)
        self._cache = cache_
302474
private function initializeCache()
    {
        // get driver
        if (!($driver = $this->config->get('CompilerCacheDriver', false))) {
            // default driver
            if ($this->isDevelopment()) {
                $driver = self::DEV_CACHE_DRIVER;
            } else {
                $driver = self::PROD_CACHE_DRIVER;
            }
        }

        // create driver instance
        try {
            $instance = $this->factory($driver, CacheDriverInterface::class);
            $this->cacheInstance = new Cache($instance);
        } catch (Exception $e) {
            throw $e;
        }
    }
759961
public function addDefinitions(array $definitions)
    {
        foreach ($definitions as $id => $definition) {
            $this->setDefinition($id, $definition);
        }
    }
406093
public function get_stores_for_definition(cache_definition $definition) {
        // Check if MUC has been disabled.
        $factory = cache_factory::instance();
        if ($factory->stores_disabled()) {
            // Yip its been disabled.
            // To facilitate this we are going to always return an empty array of stores to use.
            // This will force all cache instances to use the cachestore_dummy.
            // MUC will still be used essentially so that code using it will still continue to function but because no cache stores
            // are being used interaction with MUC will be purely based around a static var.
            return array();
        }

        $availablestores = $this->get_stores($definition->get_mode(), $definition->get_requirements_bin());
        $stores = array();
        $id = $definition->get_id();

        // Now get any mappings and give them priority.
        foreach ($this->configdefinitionmappings as $mapping) {
            if ($mapping['definition'] !== $id) {
                continue;
            }
            $storename = $mapping['store'];
            if (!array_key_exists($storename, $availablestores)) {
                continue;
            }
            if (array_key_exists($storename, $stores)) {
                $store = $stores[$storename];
                unset($stores[$storename]);
                $stores[$storename] = $store;
            } else {
                $stores[$storename] = $availablestores[$storename];
            }
        }

        if (empty($stores) && !$definition->is_for_mappings_only()) {
            $mode = $definition->get_mode();
            // Load the default stores.
            foreach ($this->configmodemappings as $mapping) {
                if ($mapping['mode'] === $mode && array_key_exists($mapping['store'], $availablestores)) {
                    $store = $availablestores[$mapping['store']];
                    if (empty($store['mappingsonly'])) {
                        $stores[$mapping['store']] = $store;
                    }
                }
            }
        }

        return $stores;
    }
597067
public static void initialize()
        throws CacheReloadException
    {
        if (InfinispanCache.get().exists(BundleMaker.NAMECACHE)) {
            InfinispanCache.get().<UUID, Type>getCache(BundleMaker.NAMECACHE).clear();
            InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLE).clear();
            InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLEMAP).clear();
        } else {
            InfinispanCache.get().<UUID, Type>getCache(BundleMaker.NAMECACHE)
                            .addListener(new CacheLogListener(BundleMaker.LOG));
            InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLE)
                            .addListener(new CacheLogListener(BundleMaker.LOG));
            InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLEMAP)
                            .addListener(new CacheLogListener(BundleMaker.LOG));
        }
    }
1143206
private function setDefinitionProperties(Definition $definition, array $array)
    {
        if (isset($array['public'])) {
            $definition->setPublic($array['public']);
        }

        if (isset($array['abstract'])) {
            $definition->setAbstract($array['abstract']);
        }

        if (isset($array['scope'])) {
            $definition->setScope($array['scope']);
        }

        if (isset($array['file'])) {
            $definition->setFile($array['file']);
        }
    }
255391
public static void initialize()
    {
        if (InfinispanCache.get().exists(Field.IDCACHE)) {
            InfinispanCache.get().<Long, Field>getCache(Field.IDCACHE).clear();
        } else {
            InfinispanCache.get().<Long, Field>getCache(Field.IDCACHE);
            InfinispanCache.get().<Long, Field>getCache(Field.IDCACHE).addListener(new CacheLogListener(Field.LOG));
        }
    }
491681
public function init()
    {
        $this->db = \PHPDaemon\Clients\Mongo\Pool::getInstance($this->config->mongoclientname->value);
        $this->cache = \PHPDaemon\Clients\Memcache\Pool::getInstance($this->config->memcacheclientname->value);
        if (!isset($this->config->limitinstances)) {
            $this->log('missing \'limitInstances\' directive');
        }
    }
811717
public function init()
    {
        $content = array();
        foreach ($this->request->files as $file) {
            $cacheFile = $this->generateCacheFile($file);

            if (! $fileContent = $this->checkCache($file, $cacheFile)) {
                $this->setupFile($file, $cacheFile);
                $fileContent = $this->getFileContent($file, $cacheFile);
            }

            $content[] = $this->afterGetFileContent($fileContent);
        }

        $this->content = implode("\n", $content);
    }
1340422
private function initializeOnDemand()
    {
        if ($this->initialized === false) {

            $this->initialized = true;
            $this->cache = $this->cacheMapper->fetchAll();

            // Run garbage collection on each HTTP request
            $this->gc();
        }
    }
189417
protected void initCacheObject() {

        CmsImageCacheHelper helper = new CmsImageCacheHelper(getCms(), false, false, true);
        setKeys("" + helper.getFilesCount());
        setVariations("" + helper.getVariationsCount());
        setCurSize(CmsFileUtil.formatFilesize(helper.getVariationsSize(), getLocale()));
    }
1043226
public function setDefinition($definition) {
        if ($definition instanceof Definition) {
            $this->definition = $definition;
        }
        else {
            $this->definition->setDefinition($definition);
        }

        $this->consoleDefinitionMerged = false;

        return $this;
    }
556546
protected function _initCache()
    {
        if (!Cache::getConfig(static::$cacheConfig)) {
            Cache::setConfig(static::$cacheConfig, [
                'className' => $this->_getDefaultCacheConfigClassName(),
                'prefix' => static::$cacheConfig . '_' . $this->_identifier,
                'duration' => $this->getConfig('interval'),
            ]);
        }
    }
53587
protected function initialize()
    {
        if ($this->initialized) {
            return;
        }

        $this->ensureDirectoryExists($this->directory, $this->create);
        $this->initialized = true;
    }