Exemplo n.º 1
0
 /**
  * Construct key
  *
  * @param string                    $name        Key name
  * @param integer                   $options     Options:
  *                                                  expire            - Expire time
  *                                                  expireIsTimestamp - Expire time is timestamp. For default false (in seconds)
  *                                                  serverAlias       - Server alias or connection object
  *                                                  rediska           - Rediska instance name, Rediska object or Rediska options for new instance
  * @param string|Rediska_Connection $serverAlias Server alias or Rediska_Connection object where key is placed. Deprecated!
  */
 public function __construct($name, $options = array(), $serverAlias = null)
 {
     if (!is_array($options)) {
         throw new Rediska_Key_Exception("\$expire argument is deprectated. Use 'expire' option");
     }
     if (!is_null($serverAlias)) {
         throw new Rediska_Key_Exception("\$serverAlias argument is deprectated. Use 'serverAlias' option");
     }
     $this->setName($name);
     parent::__construct($options);
 }
Exemplo n.º 2
0
 /**
  * Construct save handler
  *
  * @param Zend_Config|array $options
  */
 public function __construct($options = array())
 {
     if ($options instanceof Zend_Config) {
         $options = $options->toArray();
     }
     // Set default lifetime
     if (!isset($options['lifetime'])) {
         $lifetime = (int) ini_get('session.gc_maxlifetime');
         if ($lifetime != 0) {
             $options['lifetime'] = $lifetime;
         } else {
             trigger_error("Please set session.gc_maxlifetime to enable garbage collection.", E_USER_WARNING);
         }
     }
     parent::__construct($options);
     Rediska_Zend_Session_Set::setSaveHandler($this);
     $this->_set = new Rediska_Zend_Session_Set();
 }