本文整理汇总了PHP中FabrikWorker::getCache方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikWorker::getCache方法的具体用法?PHP FabrikWorker::getCache怎么用?PHP FabrikWorker::getCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikWorker
的用法示例。
在下文中一共展示了FabrikWorker::getCache方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBeforeListRender
/**
* Try to cache the list data
*/
public function onBeforeListRender()
{
if (!$this->params->get('pivot_cache')) {
return;
}
$cache = FabrikWorker::getCache();
$cache->setCaching(1);
$res = $cache->call(array(get_class($this), 'cacheResults'), $this->model->getId());
$this->model->set('data', $res);
}
示例2: getColumnData
/**
* Get a single column of data from the table, test for element filters
*
* @param mixed $col Column to grab. Element full name or id
* @param bool $distinct Select distinct values only
* @param array $opts Options: filterLimit bool - should limit to filter_list_max global param (default true)
* where - additional where filter to apply to query (@since 3.0.8)
*
* @return array Values for the column - empty array if no results found
*/
public function getColumnData($col, $distinct = true, $opts = array())
{
if (!array_key_exists($col, $this->columnData)) {
$fbConfig = JComponentHelper::getParams('com_fabrik');
$cache = FabrikWorker::getCache($this);
$opts['filters'] = $this->filters;
$res = $cache->call(array(get_class($this), 'columnData'), $this->getId(), $col, $distinct, $opts);
if (is_null($res)) {
$this->app->enqueueMessage('list model getColumn Data for ' . $col . ' failed', 'notice');
$res = array();
}
if ((int) $fbConfig->get('filter_list_max', 100) == count($res)) {
$this->app->enqueueMessage(JText::sprintf('COM_FABRIK_FILTER_LIST_MAX_REACHED', $col), 'notice');
}
$this->columnData[$col] = $res;
}
return $this->columnData[$col];
}
示例3: getColumnData
/**
* Get a single column of data from the table, test for element filters
*
* @param string $col column to get
*
* @return array values for the column - empty array if no results found
*/
public function getColumnData($col)
{
if (!array_key_exists($col, $this->columnData)) {
$fbConfig = JComponentHelper::getParams('com_fabrik');
$cache = FabrikWorker::getCache();
$res = $cache->call(array(get_class($this), 'columnData'), $this->getId(), $col);
if (is_null($res)) {
JError::raiseNotice(500, 'list model getColumn Data for ' . $col . ' failed');
}
if ((int) $fbConfig->get('filter_list_max', 100) == count($res)) {
JError::raiseNotice(500, JText::sprintf('COM_FABRIK_FILTER_LIST_MAX_REACHED', $col));
}
if (is_null($res)) {
$res = array();
}
$this->columnData[$col] = $res;
}
return $this->columnData[$col];
}
示例4: onAutocomplete_options
/**
* Ajax call to get auto complete options (now caches results)
*
* @return string json encoded options
*/
public function onAutocomplete_options()
{
// Needed for ajax update (since we are calling this method via dispatcher element is not set)
$this->setId(JRequest::getInt('element_id'));
$this->getElement(true);
$cache = FabrikWorker::getCache();
$search = JRequest::getVar('value');
echo $cache->call(array(get_class($this), 'cacheAutoCompleteOptions'), $this, $search);
}
示例5: onAutocomplete_options
/**
* Ajax call to get auto complete options (now caches results)
*
* @return string json encoded options
*/
public function onAutocomplete_options()
{
// Needed for ajax update (since we are calling this method via dispatcher element is not set)
$input = $this->app->input;
$this->setId($input->getInt('element_id'));
$this->loadMeForAjax();
$cache = FabrikWorker::getCache();
$search = $input->get('value', '', 'string');
echo $cache->call(array(get_class($this), 'cacheAutoCompleteOptions'), $this, $search);
}