本文整理汇总了PHP中kQueryCache类的典型用法代码示例。如果您正苦于以下问题:PHP kQueryCache类的具体用法?PHP kQueryCache怎么用?PHP kQueryCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了kQueryCache类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($input_parameters = null)
{
if (!kQueryCache::isCurrentQueryHandled()) {
kApiCache::disableConditionalCache();
}
$search = array();
$replace = array();
if (is_null($input_parameters)) {
$search = array_reverse(array_keys($this->values));
$replace = array_reverse($this->values);
} else {
$i = 1;
foreach ($input_parameters as $value) {
$search[] = ':p' . $i++;
if (is_null($value)) {
$replace[] = "NULL";
} else {
$replace[] = "'{$value}'";
}
}
$search = array_reverse($search);
$replace = array_reverse($replace);
}
$sql = str_replace($search, $replace, $this->queryString);
KalturaLog::debug($sql);
$sqlStart = microtime(true);
if (self::$dryRun && !preg_match('/^(\\/\\*.+\\*\\/ )?SELECT/i', $sql)) {
KalturaLog::debug("Sql dry run - " . (microtime(true) - $sqlStart) . " seconds");
} else {
try {
parent::execute($input_parameters);
} catch (PropelException $pex) {
KalturaLog::alert($pex->getMessage());
throw new PropelException("Database error");
}
$sqlTook = microtime(true) - $sqlStart;
KalturaLog::debug("Sql took - " . $sqlTook . " seconds");
KalturaMonitorClient::monitorDatabaseAccess($sql, $sqlTook);
}
}
示例2: doSelect
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
$criteriaForSelect = MetadataProfilePeer::prepareCriteriaForSelect($criteria);
$queryDB = kQueryCache::QUERY_DB_UNDEFINED;
$cacheKey = null;
$cachedResult = kQueryCache::getCachedQueryResults($criteriaForSelect, kQueryCache::QUERY_TYPE_SELECT, 'MetadataProfilePeer', $cacheKey, $queryDB);
if ($cachedResult !== null) {
$cacheKey = null;
MetadataProfilePeer::filterSelectResults($cachedResult, $criteriaForSelect);
MetadataProfilePeer::updateInstancePool($cachedResult);
return $cachedResult;
}
$con = MetadataProfilePeer::alternativeCon($con, $queryDB);
$queryResult = MetadataProfilePeer::populateObjects(BasePeer::doSelect($criteriaForSelect, $con));
if ($criteriaForSelect instanceof KalturaCriteria) {
$criteriaForSelect->applyResultsSort($queryResult);
}
if ($cacheKey !== null) {
kQueryCache::cacheQueryResults($cacheKey, $queryResult);
$cacheKey = null;
}
MetadataProfilePeer::filterSelectResults($queryResult, $criteria);
MetadataProfilePeer::addInstancesToPool($queryResult);
return $queryResult;
}
示例3: postUpdate
/**
* Code to be run after updating the object in database
* @param PropelPDO $con
*/
public function postUpdate(PropelPDO $con = null)
{
if ($this->alreadyInSave) {
return;
}
kQueryCache::invalidateQueryCache($this);
parent::postUpdate($con);
}
示例4: postUpdate
/**
* Code to be run after updating the object in database
* @param PropelPDO $con
*/
public function postUpdate(PropelPDO $con = null)
{
if ($this->alreadyInSave) {
return;
}
if ($this->isModified()) {
kQueryCache::invalidateQueryCache($this);
kEventsManager::raiseEvent(new kObjectChangedEvent($this, $this->tempModifiedColumns));
}
$this->tempModifiedColumns = array();
parent::postUpdate($con);
}
示例5: postUpdate
/**
* Code to be run after updating the object in database
* @param PropelPDO $con
*/
public function postUpdate(PropelPDO $con = null)
{
if ($this->alreadyInSave) {
return;
}
if ($this->isModified()) {
kQueryCache::invalidateQueryCache($this);
$modifiedColumns = $this->tempModifiedColumns;
$modifiedColumns[kObjectChangedEvent::CUSTOM_DATA_OLD_VALUES] = $this->oldCustomDataValues;
kEventsManager::raiseEvent(new kObjectChangedEvent($this, $modifiedColumns));
}
$this->tempModifiedColumns = array();
parent::postUpdate($con);
}
示例6: initGlobalMemcache
protected static function initGlobalMemcache()
{
if (self::$s_memcacheInited) {
return;
}
self::$s_memcacheInited = true;
self::$s_memcacheKeys = kCacheManager::getSingleLayerCache(kCacheManager::CACHE_TYPE_QUERY_CACHE_KEYS);
if (self::$s_memcacheKeys === null) {
// no reason to init the queries server, the query cache won't be used anyway
return;
}
self::$s_memcacheQueries = kCacheManager::getSingleLayerCache(kCacheManager::CACHE_TYPE_QUERY_CACHE_QUERIES);
}