/** * * Gets the list of all loaded roles for the user. * * @return array * */ public function getList() { $list = $this->_cache->fetch('list'); if (!$list) { $list = array(); } return $list; }
/** * * Returns an array describing table indexes from the cache; if the cache * entry is not available, queries the database for the index information. * * @param string $table The table name to fetch indexes for. * * @return array An array of table indexes. * */ public function fetchIndexInfo($table) { $key = $this->_getCacheKey("table/{$table}/index"); $result = $this->_cache->fetch($key); if (!$result) { $result = $this->_fetchIndexInfo($table); $this->_cache->add($key, $result); } return $result; }
/** * * Returns an array describing table indexes from the cache; if the cache * entry is not available, queries the database for the index information. * * @param string $spec The table or schema.table name to fetch indexes * for. * * @return array An array of table indexes. * */ public function fetchIndexInfo($spec) { $key = $this->_getCacheKey("table/{$spec}/index"); $result = $this->_cache->fetch($key); if (!$result) { list($schema, $table) = $this->_splitSchemaIdent($spec); $result = $this->_fetchIndexInfo($table, $schema); $this->_cache->add($key, $result); } return $result; }
/** * * Retrieve the status text from the cache and then deletes it, making it * act like a read-once session flash value. * * @return string The status text. * */ public function getStatusText() { $val = $this->_cache->fetch('status_text'); $this->_cache->delete('status_text'); return $val; }
/** * * Fetches the current model data version from the cache. * * The entry is keyed under `$prefix/model/$model_name/data_version`. * * @return int The model data version. * */ protected function _fetchVersion() { $key = $this->_prefix . "/model" . "/{$this->_model->model_name}" . "/data_version"; $result = $this->_cache->fetch($key); return $result; }
/** * * Appends a single role to the existing list of roles. * * @param string $val The role to append. * * @return void * */ public function add($val) { $data = $this->_cache->fetch('list', array()); $data[] = $val; $this->_cache->save('list', $data); }