本文整理汇总了PHP中Nette\Database\Connection::getCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::getCache方法的具体用法?PHP Connection::getCache怎么用?PHP Connection::getCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Database\Connection
的用法示例。
在下文中一共展示了Connection::getCache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPreviousAccessed
/**
* Loads cache of previous accessed columns and returns it
*
* @internal
* @return array|false
*/
public function getPreviousAccessed()
{
$cache = $this->connection->getCache();
if ($this->rows === null && $cache && !is_string($this->prevAccessed)) {
$this->accessed = $this->prevAccessed = $cache->load(array(__CLASS__, $this->name, $this->sqlBuilder->getConditions()));
}
return $this->prevAccessed;
}
示例2: __construct
/**
* Creates filtered table representation.
* @param string database table name
* @param Nette\Database\Connection
*/
public function __construct($table, Nette\Database\Connection $connection)
{
$this->name = $table;
$this->connection = $connection;
$reflection = $connection->getDatabaseReflection();
$this->primary = $reflection->getPrimary($table);
$this->sqlBuilder = new SqlBuilder($table, $connection, $reflection);
$this->cache = $connection->getCache();
}
示例3: getSql
/**
* Returns SQL query.
* @return string
*/
public function getSql()
{
$join = $this->createJoins(implode(',', $this->conditions), TRUE) + $this->createJoins(implode(',', $this->select) . ",{$this->group},{$this->having}," . implode(',', $this->order));
$cache = $this->connection->getCache();
if ($this->rows === NULL && $cache && !is_string($this->prevAccessed)) {
$this->accessed = $this->prevAccessed = $cache->load(array(__CLASS__, $this->name, $this->conditions));
}
$prefix = $join ? "{$this->delimitedName}." : '';
if ($this->select) {
$cols = $this->removeExtraTables($this->tryDelimite(implode(', ', $this->select)));
} elseif ($this->prevAccessed) {
$cols = $prefix . implode(', ' . $prefix, array_map(array($this->connection->getSupplementalDriver(), 'delimite'), array_keys($this->prevAccessed)));
} else {
$cols = $prefix . '*';
}
return "SELECT{$this->topString()} {$cols} FROM {$this->delimitedName}" . implode($join) . $this->whereString();
}
示例4: saveCacheState
protected function saveCacheState()
{
if ($this->observeCache && ($cache = $this->connection->getCache()) && !$this->sqlBuilder->getSelect() && $this->accessed != $this->prevAccessed) {
$cache->save(array(__CLASS__, $this->name, $this->sqlBuilder->getConditions()), $this->accessed);
}
}