예제 #1
0
 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
0
파일: DbTest.php 프로젝트: jsnshrmn/Suma
 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
0
파일: Multidb.php 프로젝트: nhp/shopware-4
   /**
     * 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
0
 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
0
파일: index.php 프로젝트: Aeryris/grid
#$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
0
파일: Cache.php 프로젝트: Tony133/zf-web
 /**
  * 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;
 }