示例#1
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // prefix the session class store, not the individual keys.
     $prefix = $this->_prefix;
     $this->_prefix = null;
     if (!$prefix) {
         $prefix = 'Solar_Cache_Adapter_Session';
     }
     // a session store for entries
     $this->_entries = Solar::factory('Solar_Session', array('class' => $prefix . '__entries'));
     // a session store for expires
     $this->_expires = Solar::factory('Solar_Session', array('class' => $prefix . '__expires'));
 }
示例#2
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     $this->memcache = new Memcache();
     // pool or single-server connection?
     if (empty($this->_config['pool'])) {
         // make sure we can connect
         $result = @$this->memcache->connect($this->_config['host'], $this->_config['port'], $this->_config['timeout']);
         if (!$result) {
             throw $this->_exception('ERR_CONNECTION_FAILED', array('host' => $this->_config['host'], 'port' => $this->_config['port'], 'timeout' => $this->_config['timeout']));
         }
     } else {
         // set up a pool
         $this->_createPool();
     }
 }
示例#3
0
文件: File.php 项目: kalkin/solarphp
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // path to storage; include the prefix as part of the path
     $this->_path = Solar_Dir::fix($this->_config['path'] . '/' . $this->_prefix);
     // whether or not to hash
     $this->_hash = $this->_config['hash'];
     // build the context property
     if (is_resource($this->_config['context'])) {
         // assume it's a context resource
         $this->_context = $this->_config['context'];
     } elseif (is_array($this->_config['context'])) {
         // create from scratch
         $this->_context = stream_context_create($this->_config['context']);
     } else {
         // not a resource, not an array, so ignore.
         // have to use a resource of some sort, so create
         // a blank context resource.
         $this->_context = stream_context_create(array());
     }
     // make sure the cache directory is there; create it if
     // necessary.
     if (!is_dir($this->_path)) {
         mkdir($this->_path, $this->_config['mode'], true, $this->_context);
     }
 }