本文整理汇总了PHP中Zend_Db_Table_Abstract::setDefaultMetadataCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Table_Abstract::setDefaultMetadataCache方法的具体用法?PHP Zend_Db_Table_Abstract::setDefaultMetadataCache怎么用?PHP Zend_Db_Table_Abstract::setDefaultMetadataCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Table_Abstract
的用法示例。
在下文中一共展示了Zend_Db_Table_Abstract::setDefaultMetadataCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initDbCache
protected function _initDbCache()
{
$frontendOptions = array('automatic_serialization' => true);
$backendOptions = array('cache_dir' => APPLICATION_PATH . '/../cache');
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
}
示例2: _initCache
public function _initCache()
{
$frontendOptions = array('automatic_serialization' => true);
$backendOptions = array('cache_dir' => '../cache/');
$dbCache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($dbCache);
}
示例3: init
public function init()
{
if (null === $this->_cache) {
$options = $this->getOptions();
if (!isset($options[0]) && $options) {
if (!isset($options['frontend']['adapter'])) {
$options['frontend']['adapter'] = 'Core';
}
if (!isset($options['backend']['adapter'])) {
$options['backend']['adapter'] = 'Memcached';
}
if (!isset($options['frontend']['params'])) {
$options['frontend']['params'] = array();
}
if (!isset($options['backend']['params'])) {
$options['backend']['params'] = array();
}
$this->_cache = Zend_Cache::factory($options['frontend']['adapter'], $options['backend']['adapter'], $options['frontend']['params'], $options['backend']['params']);
if (isset($options['metadata']) && true === (bool) $options['metadata']) {
Zend_Db_Table_Abstract::setDefaultMetadataCache($this->_cache);
}
if (isset($options['translate']) && true === (bool) $options['translate']) {
Zend_Translate::setCache($this->_cache);
}
if (isset($options['locale']) && true === (bool) $options['locale']) {
Zend_Locale::setCache($this->_cache);
}
} else {
$this->_cache = false;
}
$key = isset($options['registry']) && !is_numeric($options['registry']) ? $options['registry'] : self::DEFAULT_REGISTRY_KEY;
Zend_Registry::set($key, $this->_cache);
}
return $this->_cache;
}
示例4: _initCache
/**
* initalize caching
*/
protected function _initCache()
{
$config = vkNgine_Config::getSystemConfig();
$cache = new vkNgine_Cache($config->cache->use, $config->cache->type);
Zend_Registry::set('cache', $cache);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache->getCacheObject());
}
示例5: _initDb
/**
* Instantiate the application database resource object
*
* @return Zend_Db_Adapter
* @link http://framework.zend.com/manual/en/zend.db.html
*/
protected function _initDb()
{
// Only attempt to cache the metadata if we have a cache available
if (!is_null($this->_cache)) {
try {
Zend_Db_Table_Abstract::setDefaultMetadataCache($this->_cache);
} catch (Zend_Db_Table_Exception $e) {
print $e->getMessage();
}
}
$db = null;
$dbPluginResource = $this->getPluginResource('db');
if (!is_null($dbPluginResource)) {
$db = $dbPluginResource->getDbAdapter();
// Set the default fetch mode to object throughout the application
$db->setFetchMode(Zend_Db::FETCH_OBJ);
// Force the initial connection to handle error relating to caching etc.
try {
$db->getConnection();
} catch (Zend_Db_Adapter_Exception $e) {
// perhaps a failed login credential, or perhaps the RDBMS is not running
} catch (Zend_Exception $e) {
// perhaps factory() failed to load the specified Adapter class
}
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('db', $db);
}
return $db;
}
示例6: init_zend_db
/**
* Initizlize Zend DB
*/
function init_zend_db()
{
try {
include APPPATH . 'config' . DIRECTORY_SEPARATOR . 'database.php';
$__dbParams = array('host' => $db[$active_group]['hostname'], 'username' => $db[$active_group]['username'], 'password' => $db[$active_group]['password'], 'dbname' => $db[$active_group]['database'], 'persistent' => $db[$active_group]['pconnect']);
$__db = Zend_Db::factory('PDO_MYSQL', $__dbParams);
include APPPATH . 'config/cache.php';
$feEngine = $config['dbschema_frontend_engine'];
$feOptions = $config['dbschema_frontend'];
$beEngine = $config['dbschema_backend_engine'];
$beOptions = $config['dbschema_backend'];
if (isset($beOptions['cache_dir']) && !file_exists($beOptions['cache_dir'])) {
mkdir($beOptions['cache_dir']);
chmod($beOptions['cache_dir'], 0777);
}
// var_dump($beOptions['cache_dir']);
$cache = Zend_Cache::factory($feEngine, $beEngine, $feOptions, $beOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
Zend_Db_Table_Abstract::setDefaultAdapter($__db);
Profiler::start($db[$active_group], $__db);
$__db->query('SET NAMES ' . $db['default']['char_set']);
$__db->query('SET SQL_MODE = "NO_UNSIGNED_SUBTRACTION"');
} catch (Exception $e) {
header("HTTP/1.1 500 Internal Server Error (DB)");
echo $e->getMessage();
exit;
}
}
示例7: init
/**
* To init the view
*
* @return Zend_View $view
*/
public function init()
{
$frontendOptions = array('automatic_serialization' => true, 'lifetime' => 86400);
$backendOptions = array('cache_dir' => PROJECT_ROOT . '/repository/cache/');
if ('development' == APPLICATION_ENV) {
$frontendOptions['caching'] = false;
//关闭缓存
} else {
$classFileIncCache = $backendOptions['cache_dir'] . 'pluginLoaderCache.php';
if (file_exists($classFileIncCache)) {
include_once $classFileIncCache;
}
Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
}
$this->_cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($this->_cache);
//缓存Zend_Db_Table元数据
Zend_Date::setOptions(array('cache' => $this->_cache));
//缓存Zend_Date
Zend_Translate::setCache($this->_cache);
//缓存Zend_Translate
Zend_Registry::set('cache', $this->_cache);
// Return it, so that it can be stored by the bootstrap
return $this->_cache;
}
示例8: _initView
public function _initView()
{
$this->bootstrap('layout');
$layout = $this->getResource('layout');
$v = $layout->getView();
$v->addHelperPath(APPLICATION_PATH . "/../library/Core/View/Helper", "Core_View_Helper");
$config = Zend_Registry::get('config');
$version = self::getVersion();
$cache = $this->getPluginResource('cachemanager')->getCacheManager()->getCache('default');
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
Zend_Registry::set('Cache', $cache);
$this->getResourceLoader()->addResourceType('entity', 'entitys/', 'Entity');
defined('STATIC_URL') || define('STATIC_URL', $config['app']['staticUrl']);
defined('DINAMIC_URL') || define('DINAMIC_URL', $config['app']['dinamicUrl']);
defined('IMG_URL') || define('IMG_URL', $config['app']['imgUrl']);
defined('SITE_URL') || define('SITE_URL', $config['app']['siteUrl']);
defined('SITE_TEMP') || define('SITE_TEMP', $config['app']['elementTemp']);
defined('SITE_VERSION') || define('SITE_VERSION', $version);
defined('STATIC_ADMIN_IMG') || define('STATIC_ADMIN_IMG', $config['app']['imgAdmin']);
defined('ROOT_IMG_DINAMIC') || define('ROOT_IMG_DINAMIC', $config['app']['rootImgDinamic']);
$doctypeHelper = new Zend_View_Helper_Doctype();
$doctypeHelper->doctype(Zend_View_Helper_Doctype::XHTML1_STRICT);
$v->headTitle($config['resources']['view']['title'])->setSeparator(' | ');
$v->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');
$v->headMeta()->appendName("author", "multibox S.A.C");
$v->headMeta()->setName("language", "es");
$v->headMeta()->appendName("description", "portal de contenido de tonos y de musica entel");
$v->headMeta()->appendName("keywords", "tono,musica,dedicatorias,musica top,realtones,fulltracks, entel, operadora,entretenimiento");
if (APPLICATION_ENV != 'LOCAL') {
$this->frontController->throwExceptions(false);
}
}
示例9: _initCacheDir
/**
*
*/
protected function _initCacheDir()
{
$frontendOptions = array('lifetime' => 86400, 'automatic_serialization' => true, 'automatic_cleaning_factor' => 1);
$backendOptions = array('cache_dir' => APPLICATION_PATH . '/cache');
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
Zend_Date::setOptions(array('cache' => $cache));
}
示例10: _initCache
/**
* Set up the caches. Currently, just the db meta cache.
*
* @return void
*/
protected function _initCache()
{
// Db metadata cache
$frontendOptions = array('automatic_serialization' => true);
$backendOptions = array('cache_dir' => DATA_PATH . 'cache' . DS . 'dbMeta');
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
}
示例11: factory
/**
* @param string $backend
* @param array $frontendOptions
* @param array $backendOptions
* @return Zend_Cache_Core
*/
public function factory($backend, $frontendOptions = [], $backendOptions = [])
{
$backend = $this->createBackend($backend, $backendOptions);
$cacheCore = $this->createCacheCore($frontendOptions);
$cacheCore->setBackend($backend);
\Zend_Locale_Data::setCache($cacheCore);
\Zend_Db_Table_Abstract::setDefaultMetadataCache($cacheCore);
return $cacheCore;
}
示例12: _initCache
protected function _initCache()
{
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/' . SITE_NAME . '.ini');
$cacheFrontendOptions = $config->cache->cache->frontend->toArray();
$cacheBackendOptions = $config->cache->cache->backend->toArray();
$cache = Zend_Cache::factory('Core', 'File', $cacheFrontendOptions, $cacheBackendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
Zend_Registry::set('cache', $cache);
}
示例13: _initCache
public function _initCache()
{
$frontendOptions = array('lifetime' => 3600 * 24 * 60, 'automatic_serialization' => true);
$backendOptions = array('cache_dir' => '../cache/');
// получение объекта Zend_Cache_Core
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
//cache database table schemata metadata for faster SQL queries
Zend_Registry::set('cache', $cache);
}
示例14: _initCache
/**
* Démarrage du gestionnaire de caches, on récupère chaque configuration.
* Par défaut on met en cache les métadata de la bdd
*
* @return void.
*/
protected function _initCache()
{
if ((bool) APP_CACHE) {
// Récupération des ressources du gestionnaire du cache
$this->bootstrap('cachemanager');
// Activation du cache du Zend_Translate
Zend_Translate::setCache($this->getResource('cachemanager')->getCache('translate'));
// Activation du cache de la base de données
Zend_Db_Table_Abstract::setDefaultMetadataCache($this->getResource('cachemanager')->getCache('default'));
}
}
示例15: routeStartup
/**
* Set default adapter and cache for Zend_Db_Table classes
*
* @param Zend_Controller_Request_Abstract $request
*/
public function routeStartup($request = null)
{
Zend_Db_Table_Abstract::setDefaultAdapter(Zoo::getService('db')->getDb());
$frontendOptions = new Zend_Config(array('lifetime' => 86400));
try {
$metacache = Zoo::getService('cache')->getCache('metadata', 'Core', $frontendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($metacache);
} catch (Zoo_Exception_Service $e) {
// No cache service available
}
}