Ejemplo n.º 1
0
 public function testAdd()
 {
     $reply = $this->set->add(123);
     $this->assertTrue($reply);
     $values = $this->rediska->getSet('test');
     $this->assertTrue(!empty($values));
     $this->assertEquals(123, $values[0]);
 }
Ejemplo n.º 2
0
 /**
  * Create a new queue in the queues set
  *
  * @param string $name
  * @return bool
  */
 public function add($name)
 {
     $result = $this->_queuesSet->add($name);
     if ($result) {
         $queuesCache = $this->_getQueuesCache();
         $queuesCache[] = $name;
         $this->_setQueuesCache($queuesCache);
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Create a new queue
  *
  * Visibility timeout is how long a message is left in the queue "invisible"
  * to other readers.  If the message is acknowleged (deleted) before the
  * timeout, then the message is deleted.  However, if the timeout expires
  * then the message will be made available to other queue readers.
  *
  * @param  string  $name    queue name
  * @param  integer $timeout default visibility timeout
  * @return boolean
  */
 public function create($name, $timeout = null)
 {
     $this->_queues->add($name);
     $this->_queueObjects[$name] = new Rediska_Key_List($this->_getKeyName("queue_{$name}"));
     return true;
 }
Ejemplo n.º 4
0
function prd($arr)
{
    echo "<xmp>";
    if (is_array($arr) && count($arr)) {
        print_r($arr);
    } else {
        var_dump($arr);
    }
    echo "\n";
    echo "</xmp>";
    die;
}
include_once 'Rediska/Key/Set.php';
$key = 'test';
$Set = new Rediska_Key_Set($key);
$Set->add('a');
$Set->add('b');
$Set->add('b');
$Set->add('a');
prd($Set->toArray());
die;
require_once dirname(dirname(__FILE__)) . '/EventCache.php';
require_once dirname(dirname(__FILE__)) . '/EventCacheInst.php';
$E = new EventCacheInst(array('app' => 'testapp', 'trackEvents' => false, 'adapter' => 'EventCacheAdapterApc'));
#$E->flush();
//
//$E->delete('test');
//$lijst = $E->read('test');
//if (empty($lijst)) {
//	$lijst = array();
//}