Esempio n. 1
0
 public function testSets()
 {
     // Multiple arguments
     $this->assertEquals(2, $this->credis->sAdd('myset', 'Hello', 'World'));
     // Array Arguments
     $this->assertEquals(1, $this->credis->sAdd('myset', array('Hello', 'Cruel', 'World')));
     // Non-empty set
     $members = $this->credis->sMembers('myset');
     $this->assertEquals(3, count($members));
     $this->assertTrue(in_array('Hello', $members));
     // Empty set
     $this->assertEquals(array(), $this->credis->sMembers('noexist'));
 }
Esempio n. 2
0
 /**
  * Return an array of stored cache ids which don't match given tags
  *
  * In case of multiple tags, a negated logical AND is made between tags
  *
  * @param array $tags array of tags
  * @return array array of not matching cache ids (string)
  */
 public function getIdsNotMatchingTags($tags = array())
 {
     if (!$this->_notMatchingTags) {
         Zend_Cache::throwException("notMatchingTags is currently disabled.");
     }
     if ($tags) {
         return (array) $this->_redis->sDiff(self::SET_IDS, $this->_preprocessTagIds($tags));
     }
     return (array) $this->_redis->sMembers(self::SET_IDS);
 }