本文整理汇总了PHP中Zend_Db_Table::setDefaultMetadataCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Table::setDefaultMetadataCache方法的具体用法?PHP Zend_Db_Table::setDefaultMetadataCache怎么用?PHP Zend_Db_Table::setDefaultMetadataCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Table
的用法示例。
在下文中一共展示了Zend_Db_Table::setDefaultMetadataCache方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->getBootstrap()->bootstrap('db');
$frontendOptions = array('lifetime' => 86400, 'automatic_serialization' => true);
$backendOptions = array('cache_dir' => APPLICATION_PATH . '/../cache');
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
$cache->setOption('caching', $this->_caching);
Zend_Db_Table::setDefaultMetadataCache($cache);
Zend_Registry::set('cache', $cache);
}
示例2: tearDown
public function tearDown()
{
Zend_Db_Table::setDefaultMetadataCache();
// Restore original autoloaders
$loaders = spl_autoload_functions();
foreach ($loaders as $loader) {
spl_autoload_unregister($loader);
}
foreach ($this->loaders as $loader) {
spl_autoload_register($loader);
}
// Reset autoloader instance so it doesn't affect other tests
Zend_Loader_Autoloader::resetInstance();
}
示例3: _setDefaultMetadataCache
/**
* Set the default metadata cache
*
* @param string|Zend_Cache_Core $cache
* @return Zend_Application_Resource_Multidb
*/
protected function _setDefaultMetadataCache($cache)
{
$metadataCache = null;
if (is_string($cache)) {
$bootstrap = $this->getBootstrap();
if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper &&
$bootstrap->hasPluginResource('CacheManager')
) {
$cacheManager = $bootstrap->bootstrap('CacheManager')
->getResource('CacheManager');
if (null !== $cacheManager && $cacheManager->hasCache($cache)) {
$metadataCache = $cacheManager->getCache($cache);
}
}
} else if ($cache instanceof Zend_Cache_Core) {
$metadataCache = $cache;
}
if ($metadataCache instanceof Zend_Cache_Core) {
Zend_Db_Table::setDefaultMetadataCache($metadataCache);
}
return $this;
}
示例4: _initCache
protected function _initCache()
{
$cache = Zend_Cache::factory('Core', 'File', array('lifetime' => 7200, 'automatic_serialization' => true), array('cache_dir' => getcwd() . "/data/cache"));
Zend_Db_Table::setDefaultMetadataCache($cache);
Zend_Date::setOptions(array('cache' => $cache));
}
示例5: define
#$autoloader->suppressNotFoundWarnings(false);
#$autoloader->setFallbackAutoloader(true);
define('APPLICATION_PATH', getcwd());
Zend_Session::start();
// Load Config
$config = new Zend_Config_Ini('./application/config.ini', 'general');
Zend_Registry::set('config', $config);
//Cache Options
$frontendOptions = array('lifetime' => 7200, 'automatic_serialization' => true);
$backendOptions = array('cache_dir' => './data/cache/');
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
Zend_Registry::set('cache', $cache);
// Database
$db = Zend_Db::factory($config->db->adapter, $config->db->config->toArray());
Zend_Db_Table::setDefaultAdapter($db);
Zend_Db_Table::setDefaultMetadataCache($cache);
#$db->getConnection ()->exec ( "SET NAMES utf8" );
$db->setFetchMode(Zend_Db::FETCH_OBJ);
$db->setProfiler(true);
Zend_Registry::set('db', $db);
/*
//Locale
$locale = new Zend_Locale('en_US');
Zend_Registry::set('locale', $locale);
$english = array(
'Name_of' => 'Barcelos',
'message2' => 'message2',
'message3' => 'message3');
$german = array(
'Fmessage1' => 'Nachricht1',
示例6: _shareToZendObjects
/**
* Shares the cache instance
* to all Zend objects that accept one statically
*
* @return Zend_Application_Resource_Cache
*/
protected function _shareToZendObjects()
{
Zend_Paginator::setCache($this->_cache);
Zend_Db_Table::setDefaultMetadataCache($this->_cache);
Zend_Date::setOptions(array('cache' => $this->_cache));
Zend_Translate::setCache($this->_cache);
Zend_Locale::setCache($this->_cache);
return $this;
}