本文整理汇总了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);
}
}
开发者ID:DBezemer,项目名称:server,代码行数:40,代码来源:KalturaStatement.php
示例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;
}
开发者ID:DBezemer,项目名称:server,代码行数:34,代码来源:BaseMetadataProfilePeer.php
示例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);
}
开发者ID:DBezemer,项目名称:server,代码行数:12,代码来源:BaseSchedulerStatus.php
示例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);
}
开发者ID:DBezemer,项目名称:server,代码行数:16,代码来源:BaseScheduledTaskProfile.php
示例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);
}
开发者ID:wzur,项目名称:server,代码行数:18,代码来源:Basekshow.php
示例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);
}
开发者ID:DBezemer,项目名称:server,代码行数:13,代码来源:kQueryCache.php
注:本文中的kQueryCache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论