Populate the local cache from DB.

        Read the entries from FW DB and Calls routines to populate the cache.
431424
def populate_local_cache(self):
        
        fw_dict = self.get_all_fw_db()
        for fw_id in fw_dict:
            LOG.info("Populating cache for FW %s", fw_id)
            fw_data = fw_dict[fw_id]
            self.populate_local_cache_tenant(fw_id, fw_data)
231457
def _init_db(self):
        """"""
        with self._get_db() as db:
            with open(self.schemapath) as f:
                db.cursor().executescript(f.read())
            db.commit()
917728
def load_from_db(self, cache=False):
        """"""
        a = {}
        db_prefs = {p.preference.identifier(): p for p in self.queryset}
        for preference in self.registry.preferences():
            try:
                db_pref = db_prefs[preference.identifier()]
            except KeyError:
                db_pref = self.create_db_pref(
                    section=preference.section.name,
                    name=preference.name,
                    value=preference.get('default'))
            else:
                # cache if create_db_pref() hasn't already done so
                if cache:
                    self.to_cache(db_pref)

            a[preference.identifier()] = db_pref.value

        return a
1159388
private void populateLocalCache() {
      CloseableIterator iterator = cache.keySet().iterator();
      try {
         while (iterator.hasNext()) {
            get(null, iterator.next());
         }
      } finally {
         iterator.close();
      }
   }
934435
def update(self, db):
        

        self.lock.acquire()
        update_db(self.db, db.db)
        self.lock.release()
866570
function _initStorage(options) {
    var self = this;
    var dbInfo = {
        db: null
    };

    if (options) {
        for (var i in options) {
            dbInfo[i] = options[i];
        }
    }

    // Get the current context of the database;
    var dbContext = dbContexts[dbInfo.name];

    // ...or create a new context.
    if (!dbContext) {
        dbContext = createDbContext();
        // Register the new context in the global container.
        dbContexts[dbInfo.name] = dbContext;
    }

    // Register itself as a running localForage in the current context.
    dbContext.forages.push(self);

    // Replace the default `ready()` function with the specialized one.
    if (!self._initReady) {
        self._initReady = self.ready;
        self.ready = _fullyReady;
    }

    // Create an array of initialization states of the related localForages.
    var initPromises = [];

    function ignoreErrors() {
        // Don't handle errors here,
        // just makes sure related localForages aren't pending.
        return Promise$1.resolve();
    }

    for (var j = 0; j < dbContext.forages.length; j++) {
        var forage = dbContext.forages[j];
        if (forage !== self) {
            // Don't wait for itself...
            initPromises.push(forage._initReady()["catch"](ignoreErrors));
        }
    }

    // Take a snapshot of the related localForages.
    var forages = dbContext.forages.slice(0);

    // Initialize the connection process only when
    // all the related localForages aren't pending.
    return Promise$1.all(initPromises).then(function () {
        dbInfo.db = dbContext.db;
        // Get the connection or open a new one without upgrade.
        return _getOriginalConnection(dbInfo);
    }).then(function (db) {
        dbInfo.db = db;
        if (_isUpgradeNeeded(dbInfo, self._defaultConfig.version)) {
            // Reopen the database for upgrading.
            return _getUpgradedConnection(dbInfo);
        }
        return db;
    }).then(function (db) {
        dbInfo.db = dbContext.db = db;
        self._dbInfo = dbInfo;
        // Share the final connection amongst related localForages.
        for (var k = 0; k < forages.length; k++) {
            var forage = forages[k];
            if (forage !== self) {
                // Self is already up-to-date.
                forage._dbInfo.db = dbInfo.db;
                forage._dbInfo.version = dbInfo.version;
            }
        }
    });
}
1155204
private function populate() {
	
		$res = Database::load('SELECT * FROM `options` ORDER BY `group`');
			
		$this->list = array();
			
		foreach ($res as $o) {
			
			// esplode le options
			if ('list'==$o->type) {
				
				$listItems = explode('|', $o->list_options);
				
				foreach ($listItems as $listEntry) {
					
					list ($val,$text)	= explode(',', $listEntry);
					
					$listItem = new \stdClass();
					
					$listItem->value = $val;
					$listItem->text  = $text;
					
					$o->listItems[] = $listItem;
					
				}
				
			}

			// casting
			$o->value = $this->castTo($o->value, $o->type);
			
			$this->list[$o->name] = $o;
			
		}
	
	}
995606
public function populate(): void
  {
    foreach ($this->data as $data)
    {
      $this->rowFactory->createRow($this, $data);
    }
  }
464206
protected function populate()
    {
        $this->collection = AnalyticsDb::ADB_DIMS;

        // $match
        $this->pipeline['$match']['entity'] = $this->entity;
        $this->pipeline['$match']['ts'] = ['$gte' => $this->dateRange[0], '$lte' => $this->dateRange[1]];
        if(!empty($this->ref)){
            $this->pipeline['$match']['count.' . $this->ref] = ['$exists' => true];
        }else{
            $this->pipeline['$match']['count'] = ['$exists' => true];
        }


        // $project
        $this->pipeline['$project'] = [
            'ts'     => 1,
            'entity' => 1,
            'month'  => 1,
            'year'   => 1,
            'name'   => 1,
            'value'  => 1,
            'total'  => 1
        ];

        if (!empty($this->ref)) {
            $this->pipeline['$project']['count.' . $this->ref] = 1;
        }

        // $group
        $this->pipeline['$group'] = ['_id' => '$ts', 'totalCount' => ['$sum' => $this->getSumField()]];

        // $sort -> by timestamp
        $this->pipeline['$sort'] = ['_id' => 1];
    }
103052
public function populate()
    {
        foreach ($this->languages as $language => $key) {
            $contents = $this->contentRepository->findByContentTypeAndCondition($language);

            $this->multipleIndexor->indexMultiple($contents);
        }
    }
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();
    }
201337
public void populate() throws Exception {
        for (int i = 0; i < _initialCapacity; i++) {
            String str = "key." + i;
            byte[] key = str.getBytes();
            byte[] value = createDataForKey(str);
            _store.put(key, value);
        }
        _store.sync();
    }
397232
def _populate_setup(self):
        
        makedirs(os.path.dirname(self._cache_marker))
        with codecs.open(self._cache_marker, 'w', encoding='utf-8') as fobj:
            fobj.write(self.cache_uri)
        self.graph.open(self.cache_uri)
70582
function () {

    if (this.initialized) {
      return;
    }

    this.structure = cache.get(CONST.SYSTEM_DB_STRUCTURE);
    this.board = cache.get(CONST.SYSTEM_DB_BOARD);
    this.route = cache.get(CONST.SYSTEM_DB_ROUTE);
    this.initialized = true;
    this.bind();
  }
867894
def update_datasources_cache():
    """"""
    from superset.models.core import Database
    for database in db.session.query(Database).all():
        if database.allow_multi_schema_metadata_fetch:
            print('Fetching {} datasources ...'.format(database.name))
            try:
                database.all_table_names_in_database(
                    force=True, cache=True, cache_timeout=24 * 60 * 60)
                database.all_view_names_in_database(
                    force=True, cache=True, cache_timeout=24 * 60 * 60)
            except Exception as e:
                print('{}'.format(str(e)))
142657
protected function load()
    {
        if ($this->btTable) {
            if ($this->btCacheBlockRecord && $this->btCachedBlockRecord && Config::get('concrete.cache.blocks')) {
                $this->record = unserialize(base64_decode($this->btCachedBlockRecord));
            } else {
                $this->record = new BlockRecord($this->btTable);
                $this->record->bID = $this->bID;
                $this->record->Load('bID=' . $this->bID);
                if ($this->btCacheBlockRecord && Config::get('concrete.cache.blocks')) {
                    // this is the first time we're loading
                    $record = base64_encode(serialize($this->record));
                    $db = Database::connection();
                    $db->Execute('update Blocks set btCachedBlockRecord = ? where bID = ?', [$record, $this->bID]);
                }
            }
        }

        $event = new \Symfony\Component\EventDispatcher\GenericEvent();
        $event->setArgument('record', $this->record);
        $event->setArgument('btHandle', $this->btHandle);
        $event->setArgument('bID', $this->bID);
        $ret = Events::dispatch('on_block_load', $event);
        $this->record = $ret->getArgument('record');

        if (is_object($this->record)) {
            foreach ($this->record as $key => $value) {
                $this->{$key} = $value;
                $this->set($key, $value);
            }
        }
    }
754368
protected void loadCacheMapping() {
		File f = new File(getCacheFilePath());
		if (f.exists()) {
			try(InputStream is = new FileInputStream(f); BufferedReader rd = new BufferedReader(new FileReader(f))) {
				cacheProperties.load(is);
				for (Enumeration<?> properyNames = cacheProperties.propertyNames(); properyNames.hasMoreElements();) {
					String propName = (String) properyNames.nextElement();
					if (propName.startsWith(JAWR_MAPPING_PREFIX)) {

						String value = cacheProperties.getProperty(propName);

						String resourceMapping = propName.substring(JAWR_MAPPING_PREFIX.length());
						String[] mappings = value.split(SEMICOLON);
						List<FilePathMapping> fMappings = new CopyOnWriteArrayList<>();

						// TODO check the use of mappingModified
						boolean mappingModified = true;
						for (String fmapping : mappings) {
							String[] mapping = fmapping.split(MAPPING_TIMESTAMP_SEPARATOR);
							long lastModified = Long.parseLong(mapping[1]);
							String filePath = mapping[0];
							if (rsHandler.getLastModified(filePath) != lastModified) {
								mappingModified = false;
								break;
							}
							FilePathMapping fmap = new FilePathMapping(filePath, lastModified);
							fMappings.add(fmap);
						}

						if (mappingModified) {
							linkedResourceMap.put(resourceMapping, fMappings);
						}
					}
				}

			} catch (IOException e) {
				throw new BundlingProcessException("Unable to initialize " + getName() + " Generator cache", e);
			}
		}
	}