Example #1
0
 /**
  * 
  * Checks to make sure the EAccelerator extension is available.
  * 
  * @return void
  * 
  */
 protected function _preConfig()
 {
     parent::_preConfig();
     if (!(extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'))) {
         throw $this->_exception('ERR_EXTENSION_NOT_LOADED', array('extension' => 'eaccelerator'));
     }
 }
Example #2
0
 /**
  * 
  * Drops a sequence from the database.
  * 
  * @param string $name The sequence name to drop.
  * 
  * @return void
  * 
  */
 public function dropSequence($name)
 {
     $this->_cache->deleteAll();
     $name = $this->_modSequenceName($name);
     $result = $this->_dropSequence($name);
     return $result;
 }
Example #3
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'));
 }
Example #4
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();
     }
 }
Example #5
0
 /**
  * 
  * 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);
     }
 }
Example #6
0
 /**
  * 
  * 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;
 }
Example #7
0
 /**
  * 
  * 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->getList();
     $data[] = $val;
     $this->_cache->save('list', $data);
 }
Example #8
0
 /**
  * 
  * 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;
 }
Example #9
0
 /**
  * 
  * 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);
 }