Returns the cached version if exists; does not update the entity from the database in that case
967983
protected ProcessDefinitionEntity loadProcessDefinition(String processDefinitionId) {
    ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
    DeploymentCache deploymentCache = configuration.getDeploymentCache();

    ProcessDefinitionEntity processDefinition = deploymentCache.findProcessDefinitionFromCache(processDefinitionId);

    if (processDefinition == null) {
      CommandContext commandContext = Context.getCommandContext();
      ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();
      processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);

      if (processDefinition != null) {
        processDefinition = deploymentCache.resolveProcessDefinition(processDefinition);
      }
    }

    return processDefinition;

  }
1220430
public VersionComparator getSchemaVersion() {
        PreparedStatement statement = null;
        ResultSet results = null;
        try {
            statement = connection.prepareStatement("SELECT \"VERSION\" FROM \"SCHEMAVERSION\"");
            results = statement.executeQuery();

            if (results.next()) {
                return new VersionComparator(results.getString(1));
            }
        } catch (SQLException e) {
            // throw it away
        } finally {
            DbUtil.close(results);
            DbUtil.close(statement);
            //DbUtil.close(connection); // do not close connection
        }
        return null;
    }
882106
function (cb) {

            model.VersionedModel.find({ refId: record._id }, 'dateCreated modifiedBy', { lean: 1, sort: { dateCreated: -1 } }, function (err, result) {
                return cb(err, result);
            });

        }
80009
def get_pypi_version(self):
        
        if self.args.disable_check_update:
            return

        # If the cached file exist, read-it
        cached_data = self._load_cache()

        if cached_data == {}:
            # Update needed
            # Update and save the cache
            thread = threading.Thread(target=self._update_pypi_version)
            thread.start()
        else:
            # Update not needed
            self.data['latest_version'] = cached_data['latest_version']
            logger.debug("Get Glances version from cache file")
1298637
@SuppressWarnings("unchecked")
    @Transactional
    public Comparable<Object> getVersion(E entity) {
        EntityType<E> entityType = entityManager.getMetamodel().entity(type);
        if (!entityType.hasVersionAttribute()) {
            return null;
        }
        return (Comparable<Object>) jpaUtil.getValue(entity, getVersionAttribute(entityType));
    }
831468
@Nullable
    public V get() {
        if (!valueRetrieved) {
            cacheValue = databaseReader.get();
            valueRetrieved = true;
        }
        return cacheValue;
    }
443154
public int getVersion(final Object iPojo) {
		final ODocument record = getRecordByUserObject(iPojo, false);

		if (record == null)
			throw new OObjectNotManagedException("The object " + iPojo + " is not managed by current database");

		return record.getVersion();
	}
303788
def last_updated(self):
        '''
        
        '''
        derived_path = self.context.request.url
        timestamp_key = self.timestamp_key_for(derived_path)

        if self.exists(self.timestamp_key_for, derived_path):
            return self.storage.get(timestamp_key)

        return None
352673
protected function getLastEditedAndStageForVersion($version)
    {
        // Cache key
        $baseTable = $this->baseTable();
        $id = $this->owner->ID;
        $key = "{$baseTable}#{$id}/{$version}";

        // Check cache
        if (isset($this->versionModifiedCache[$key])) {
            return $this->versionModifiedCache[$key];
        }

        // Build query
        $table = "\"{$baseTable}_Versions\"";
        $query = SQLSelect::create(['"LastEdited"', '"WasPublished"'], $table)
            ->addWhere([
                "{$table}.\"RecordID\"" => $id,
                "{$table}.\"Version\"" => $version
            ]);
        $result = $query->execute()->record();
        if (!$result) {
            return null;
        }
        $list = [
            $result['LastEdited'],
            $result['WasPublished'] ? static::LIVE : static::DRAFT,
        ];
        $this->versionModifiedCache[$key] = $list;
        return $list;
    }
84514
def get_db_version(db_filename: Path) -> int:
    """"""

    assert os.path.exists(db_filename)

    # Perform a query directly through SQL rather than using
    # storage.get_version()
    # as get_version will return the latest version if it doesn't
    # find a record in the database.
    conn = sqlite3.connect(
        str(db_filename),
        detect_types=sqlite3.PARSE_DECLTYPES,
    )
    cursor = conn.cursor()

    try:
        cursor.execute('SELECT value FROM settings WHERE name="version";')
        result = cursor.fetchone()
    except sqlite3.OperationalError:
        raise RuntimeError(
            'Corrupted database. Database does not the settings table.',
        )

    if not result:
        raise RuntimeError(
            'Corrupted database. Settings table does not contain an entry the db version.',
        )

    return int(result[0])
533598
def entity(self, attr, schema=None):
        
        try:
            return self._cache[attr]
        except KeyError, ke:
            return self.map_to(attr, tablename=attr, schema=schema)
1215746
public Version getDetailedVersion(String version) {
		prepareDetailedVersions();

		if (detailedVersions.containsKey(version)) {
			return detailedVersions.get(version);
		}
		
		return null;
	}
1194776
private function _checkStructureVersion()
    {
        $result = $this->_query("SELECT num FROM version");
        if (!$result) return false;
        $row = @sqlite_fetch_array($result);
        if (!$row) {
            return false;
        }
        if (((int) $row['num']) != 1) {
            // old cache structure
            $this->_log('Zend_Cache_Backend_Sqlite::_checkStructureVersion() : old cache structure version detected => the cache is going to be dropped');
            return false;
        }
        return true;
    }
1154997
protected function _getVersion()
    {
        if (!isset($this->_version)) {
            //if table doesn't exists
                $this->_db->execute(<<<EOF
CREATE TABLE IF NOT EXISTS `#__migrator_versions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `component` varchar(255) NOT NULL,
  `version` text NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `component` (`component`)
)ENGINE=InnoDB;
EOF
                );
            $this->_version = $this->getService('repos:migrator.version')
                    ->findOrAddNew(array('component' => $this->_component));
        }

        return $this->_version;
    }
1136232
def _getCachedValue(obj, relicFunc, resultType):
    
    # If the value has not been previously cached, fetch 
    if not obj.cached:
        obj.cached = resultType()
        relicFunc(byref(obj.cached))
    return obj.cached
903944
def _cached(self, dbname, coll, index):
        """"""
        cache = self.__index_cache
        now = datetime.datetime.utcnow()
        with self.__index_cache_lock:
            return (dbname in cache and
                    coll in cache[dbname] and
                    index in cache[dbname][coll] and
                    now < cache[dbname][coll][index])
837713
public static int getDatabaseVersion() {
        Integer databaseVersion = getMetaDataInteger(METADATA_VERSION);

        if ((databaseVersion == null) || (databaseVersion == 0)) {
            databaseVersion = 1;
        }

        return databaseVersion;
    }