public function ltrim($listName, $start = 0, $end = -1)
 {
     $key = new \Rediska_Key_List($listName);
     try {
         $key->truncate($start, $end);
     } catch (\Rediska_Exception $e) {
         throw new \VisitCounter\Exception\RedisException($e->getMessage(), 0, $e);
     }
     return true;
 }
Exemple #2
0
 /**
  * Writer constructor
  * 
  * @param string            $keyName Log key name
  * @param Zend_Config|array $options Rediska options
  */
 public function __construct($keyName, $options = array())
 {
     if ($options instanceof Zend_Config) {
         $options = $options->toArray();
     }
     $defaultInstance = Rediska::getDefaultInstance();
     if (empty($options) && $defaultInstance) {
         $rediska = $defaultInstance;
     } else {
         $rediska = new Rediska($options);
     }
     $this->_list = new Rediska_Key_List($keyName);
     $this->_list->setRediska($rediska);
 }
Exemple #3
0
 public function testSort()
 {
     $this->rediska->appendToList('test', 123);
     $this->rediska->appendToList('test', 456);
     $this->rediska->appendToList('test', 789);
     $values = $this->list->sort(array('order' => 'desc', 'limit' => 2));
     $this->assertEquals(array(789, 456), $values);
 }
Exemple #4
0
 public function __construct($userId = null)
 {
     return parent::__construct(self::_getKey($userId));
 }
 function get_basic_lists($iterations = 1000)
 {
     $result = array();
     for ($j = 0; $j < $this->set_iteration; $j++) {
         $list = new Rediska_Key_List($this->list_variable . $j);
         $result[$j] = $list->getValues();
     }
     return $result;
 }
Exemple #6
0
 public static function getAgentsIndexHost($haddr, $namespace = '')
 {
     $indexKey = empty($namespace) ? "agents-{$haddr}" : "agents-{$haddr}-{$namespace}";
     $agentsIndex = new Rediska_Key_List($indexKey);
     return $agentsIndex->toArray(0, 10000);
 }
Exemple #7
0
 public function getList($listKey)
 {
     $List = new Rediska_Key_List($listKey);
     $List->setRediska($this->Rediska);
     return $List->toArray();
 }