当前位置: 首页>>代码示例>>PHP>>正文


PHP Redis::srem方法代码示例

本文整理汇总了PHP中Redis::srem方法的典型用法代码示例。如果您正苦于以下问题:PHP Redis::srem方法的具体用法?PHP Redis::srem怎么用?PHP Redis::srem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Redis的用法示例。


在下文中一共展示了Redis::srem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: it_can_srem

 public function it_can_srem()
 {
     $this->redis->srem('test', 'test')->shouldBeCalled();
     $this->sRem('test', ['test']);
     $this->redis->srem('test', 'test')->willThrow(new \RedisException());
     $this->shouldThrow(DriverException::class)->during('sRem', ['test', ['test']]);
 }
开发者ID:mgdigital,项目名称:busque,代码行数:7,代码来源:PHPRedisAdapterSpec.php

示例2: removeSurvey

 public function removeSurvey($surveyID)
 {
     if (!$this->exists()) {
         return;
     }
     Redis::srem("User:{$this->id}:surveys", $surveyID);
 }
开发者ID:nickyleach,项目名称:OSTSurvey,代码行数:7,代码来源:User.php

示例3: disable_feature

 /**
  * Disable a dark launch feature
  * @param $feature string - The name of the feature
  */
 public function disable_feature($feature_name)
 {
     $multi = $this->redis->multi();
     $this->redis->del("{$this->feature_namespace()}:feature:{$feature_name}");
     $this->redis->srem("{$this->feature_namespace()}:features", $feature_name);
     $multi->exec();
 }
开发者ID:stevenharradine,项目名称:php-dark-launch,代码行数:11,代码来源:Dark_Launch.php

示例4: disable_feature

 /**
  * Disable a dark launch feature
  * @param $feature string - The name of the feature
  */
 public function disable_feature($feature_name)
 {
     $feature_name = str_replace('_', '-', $feature_name);
     $multi = $this->redis->multi();
     $this->redis->hdel("{$this->_feature_namespace()}:feature", $feature_name);
     $this->redis->srem("{$this->_feature_namespace()}:features", $feature_name);
     $multi->exec();
 }
开发者ID:kkwoker,项目名称:php-dark-launch,代码行数:12,代码来源:Dark_Launch.php

示例5: setPausedWorker

 /**
  * Mark a worker as paused/active
  *
  * @since 0.0.1
  * @param string    $workerName Name of the paused worker
  * @param bool      $paused     Whether to mark the worker as paused or active
  */
 public function setPausedWorker($workerName, $paused = true)
 {
     if ($paused) {
         $this->redis->sadd(self::$pausedWorkerKey, $workerName);
     } else {
         $this->redis->srem(self::$pausedWorkerKey, $workerName);
     }
 }
开发者ID:nosun,项目名称:php-resque-cronjob,代码行数:15,代码来源:ResqueStatus.php

示例6: Redis

<?php

//$file = 'lock.lock';
//$fp = fopen($file,'r+');
//$flag1 = flock($fp,LOCK_EX);
//
//
//$fp2 = fopen($file,'r+');
////$flag2 = flock($fp2,LOCK_EX);
////var_dump($flag1,$flag2);
/**
 * redis锁
 */
$redis = new Redis();
$redis->conncec('127.0.0.1', 6379);
$redis = new Redis();
$redis->conncec('127.0.0.1', 6379);
for ($i = 0; $i < 3; ++$i) {
    if ($redis->isMember(1)) {
        sleep(1);
    } else {
        $redis->sadd('lock_stock', 1);
        break;
    }
}
//正常的扣库存流程了
$redis->srem('stock_lock', 1);
开发者ID:kunx-edu,项目名称:tp1030,代码行数:27,代码来源:test.php

示例7: rand

$redis->lpop("list");
$redis->rpop("list");
echo $redis->lsize("list");
echo $redis->lget("list", 0);
echo $redis->lset("list", 1, "new_value");
$data = $redis->lRange("list", 0, -1);
echo "<pre>";
print_r($data);
$bool = $redis->ltrim("list", 0, 5);
echo $redis->lrem("list", "5");
$bool = $redis->rpoplpush("srcKey", "dstKey");
// SET
for ($i = 0; $i < 10; $i++) {
    $redis->sadd("myset", $i + rand(10, 99));
}
$bool = $redis->srem("myset", 16);
echo (int) $bool;
$bool = $redis->sMove("myset", "myset1", 35);
echo $bool;
$data = $redis->smembers("myset");
$bool = $redis->sismember("myset", 555);
echo (int) $bool;
echo $redis->scard("myset");
$redis->sinterstore("output", "myset", "myset1");
$data = $redis->smembers("output");
echo "<pre>";
// sort
$data = $redis->sort("myset", array("sort" => "desc"));
echo "<pre>";
print_r($data);
for ($i = 0; $i < 10; $i++) {
开发者ID:isS,项目名称:NoSQL,代码行数:31,代码来源:redisWithPHP.php

示例8: checkSerializer

 private function checkSerializer($mode)
 {
     $this->redis->del('key');
     $this->assertTrue($this->redis->getOption(Redis::OPT_SERIALIZER) === Redis::SERIALIZER_NONE);
     // default
     $this->assertTrue($this->redis->setOption(Redis::OPT_SERIALIZER, $mode) === TRUE);
     // set ok
     $this->assertTrue($this->redis->getOption(Redis::OPT_SERIALIZER) === $mode);
     // get ok
     // lPush, rPush
     $a = array('hello world', 42, TRUE, array('<tag>' => 1729));
     $this->redis->del('key');
     $this->redis->lPush('key', $a[0]);
     $this->redis->rPush('key', $a[1]);
     $this->redis->rPush('key', $a[2]);
     $this->redis->rPush('key', $a[3]);
     // lrange
     $this->assertTrue($a === $this->redis->lrange('key', 0, -1));
     // lGet
     $this->assertTrue($a[0] === $this->redis->lGet('key', 0));
     $this->assertTrue($a[1] === $this->redis->lGet('key', 1));
     $this->assertTrue($a[2] === $this->redis->lGet('key', 2));
     $this->assertTrue($a[3] === $this->redis->lGet('key', 3));
     // lrem
     $this->assertTrue($this->redis->lrem('key', $a[3]) === 1);
     $this->assertTrue(array_slice($a, 0, 3) === $this->redis->lrange('key', 0, -1));
     // lSet
     $a[0] = array('k' => 'v');
     // update
     $this->assertTrue(TRUE === $this->redis->lSet('key', 0, $a[0]));
     $this->assertTrue($a[0] === $this->redis->lGet('key', 0));
     // lInsert
     $this->assertTrue($this->redis->lInsert('key', Redis::BEFORE, $a[0], array(1, 2, 3)) === 4);
     $this->assertTrue($this->redis->lInsert('key', Redis::AFTER, $a[0], array(4, 5, 6)) === 5);
     $a = array(array(1, 2, 3), $a[0], array(4, 5, 6), $a[1], $a[2]);
     $this->assertTrue($a === $this->redis->lrange('key', 0, -1));
     // sAdd
     $this->redis->del('{set}key');
     $s = array(1, 'a', array(1, 2, 3), array('k' => 'v'));
     $this->assertTrue(1 === $this->redis->sAdd('{set}key', $s[0]));
     $this->assertTrue(1 === $this->redis->sAdd('{set}key', $s[1]));
     $this->assertTrue(1 === $this->redis->sAdd('{set}key', $s[2]));
     $this->assertTrue(1 === $this->redis->sAdd('{set}key', $s[3]));
     // variadic sAdd
     $this->redis->del('k');
     $this->assertTrue(3 === $this->redis->sAdd('k', 'a', 'b', 'c'));
     $this->assertTrue(1 === $this->redis->sAdd('k', 'a', 'b', 'c', 'd'));
     // srem
     $this->assertTrue(1 === $this->redis->srem('{set}key', $s[3]));
     $this->assertTrue(0 === $this->redis->srem('{set}key', $s[3]));
     // variadic
     $this->redis->del('k');
     $this->redis->sAdd('k', 'a', 'b', 'c', 'd');
     $this->assertTrue(2 === $this->redis->sRem('k', 'a', 'd'));
     $this->assertTrue(2 === $this->redis->sRem('k', 'b', 'c', 'e'));
     $this->assertTrue(FALSE === $this->redis->exists('k'));
     // sismember
     $this->assertTrue(TRUE === $this->redis->sismember('{set}key', $s[0]));
     $this->assertTrue(TRUE === $this->redis->sismember('{set}key', $s[1]));
     $this->assertTrue(TRUE === $this->redis->sismember('{set}key', $s[2]));
     $this->assertTrue(FALSE === $this->redis->sismember('{set}key', $s[3]));
     unset($s[3]);
     // sMove
     $this->redis->del('{set}tmp');
     $this->redis->sMove('{set}key', '{set}tmp', $s[0]);
     $this->assertTrue(FALSE === $this->redis->sismember('{set}key', $s[0]));
     $this->assertTrue(TRUE === $this->redis->sismember('{set}tmp', $s[0]));
     unset($s[0]);
     // sorted sets
     $z = array('z0', array('k' => 'v'), FALSE, NULL);
     $this->redis->del('key');
     // zAdd
     $this->assertTrue(1 === $this->redis->zAdd('key', 0, $z[0]));
     $this->assertTrue(1 === $this->redis->zAdd('key', 1, $z[1]));
     $this->assertTrue(1 === $this->redis->zAdd('key', 2, $z[2]));
     $this->assertTrue(1 === $this->redis->zAdd('key', 3, $z[3]));
     // zRem
     $this->assertTrue(1 === $this->redis->zRem('key', $z[3]));
     $this->assertTrue(0 === $this->redis->zRem('key', $z[3]));
     unset($z[3]);
     // check that zRem doesn't crash with a missing parameter (GitHub issue #102):
     $this->assertTrue(FALSE === @$this->redis->zRem('key'));
     // variadic
     $this->redis->del('k');
     $this->redis->zAdd('k', 0, 'a');
     $this->redis->zAdd('k', 1, 'b');
     $this->redis->zAdd('k', 2, 'c');
     $this->assertTrue(2 === $this->redis->zRem('k', 'a', 'c'));
     $this->assertTrue(1.0 === $this->redis->zScore('k', 'b'));
     $this->assertTrue($this->redis->zRange('k', 0, -1, true) == array('b' => 1.0));
     // zRange
     $this->assertTrue($z === $this->redis->zRange('key', 0, -1));
     // zScore
     $this->assertTrue(0.0 === $this->redis->zScore('key', $z[0]));
     $this->assertTrue(1.0 === $this->redis->zScore('key', $z[1]));
     $this->assertTrue(2.0 === $this->redis->zScore('key', $z[2]));
     // zRank
     $this->assertTrue(0 === $this->redis->zRank('key', $z[0]));
     $this->assertTrue(1 === $this->redis->zRank('key', $z[1]));
     $this->assertTrue(2 === $this->redis->zRank('key', $z[2]));
//.........这里部分代码省略.........
开发者ID:Jerry-Shaw,项目名称:phpredis,代码行数:101,代码来源:RedisTest.php


注:本文中的Redis::srem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。