コード例 #1
7
<?php

require 'vendor/autoload.php';
Predis\Autoloader::register();
$client = new Predis\Client(array('host' => '127.0.0.1', 'port' => 6379), array('prefix' => 'php:'));
$client->set("string:my_key", "Hello World");
$client->get("string:my_key");
# "Hello World"
$client->incr("string:counter");
$client->mget(array("string:my_key", "string:counter"));
# array('Hello World', '2')
$client->rpush("list:my_list", "item1", "item2");
$client->lpop("list:my_list");
# 'item1'
$client->hset("set:redis_book", "title", "Redis Essentials");
$client->hgetall("set:redis_book");
# array('title' => 'Redis Essentials')
$client->sadd("set:users", "alice", "bob");
$client->smembers("set:users");
# array('bob', 'alice')
$client->zadd("sorted_set:programmers", 1940, "Alan Kay");
$client->zadd("sorted_set:programmers", 1912, "Alan Turing");
$client->zrange("sorted_set:programmers", 0, -1, "withscores");
# array('Alan Turing' => 1912, 'Alan Kay' => 1940)
コード例 #2
3
ファイル: sorted_set.php プロジェクト: cdandy/code-lib
require "../shared.php";
$predis = new Predis\Client($single_server);
//some common
//var_dump($predis->zadd('zset-key1','a',3,'b',2,'c',1));
//var_dump($predis->zadd('zset-key1',3,'a',2,'b'));
//var_dump($predis->zadd('zset-key1',2,'b',1,'c'));
//var_dump($predis->zcard('zset-key1'));
//var_dump($predis->zincrby('zset-key1',3,'c'));
//var_dump($predis->zscore('zset-key','b'));
//var_dump($predis->zrank('zset-key','c'));
//var_dump($predis->zcount('zset-key',0,3));
//var_dump($predis->zrem('zset-key','b'));
//var_dump($predis->zrange('zset-key',0,-1,array( 'withscores'  => true)));
//A sample interaction showing ZINTERSTORE and ZUNIONSTORE
/*
var_dump($predis->zadd('zset-1',1,'a'));
var_dump($predis->zadd('zset-1',2,'b'));
var_dump($predis->zadd('zset-1',3,'c'));

var_dump($predis->zadd('zset-2',4,'b'));
var_dump($predis->zadd('zset-2',0,'d'));
var_dump($predis->zadd('zset-2',1,'c'));

var_dump($predis->zinterstore('zset-i',['zset-1','zset-2'])); //交集运算
*/
var_dump($predis->zrange('zset-i', 0, -1, array('withscores' => true)));
var_dump($predis->zunionstore('zset-u', ['zset-1', 'zset-2'], array('aggregate' => 'min')));
var_dump($predis->zrange('zset-i', 0, -1, array('withscores' => true)));
var_dump($predis->sadd('set-1', 'a', 'b'));
var_dump($predis->zunionstore('zset-u2', ['zset-1', 'zset-2', 'set-1']));
var_dump($predis->zrange('zset-u2', 0, -1, array('withscores' => true)));
コード例 #3
-7
ファイル: routes.php プロジェクト: huycao/yodelivery
$app->group(['prefix' => 'demo'], function ($app) {
    $app->get('tvc', 'App\\Http\\Controllers\\HomeController@demoTVC');
    $app->get('run-vast-support', 'App\\Http\\Controllers\\HomeController@demoVast');
    $app->get('run-popup', 'App\\Http\\Controllers\\HomeController@demoPopup');
    $app->get('balloon', 'App\\Http\\Controllers\\HomeController@demoBalloon');
    $app->get('pause-vast', 'App\\Http\\Controllers\\HomeController@demoPauseVast');
    $app->get('sidekicknew', 'App\\Http\\Controllers\\HomeController@demoSidekick');
});
$app->get('delivery', 'App\\Http\\Controllers\\DeliveryController@adsProcess');
$app->get('delivery/ova', 'App\\Http\\Controllers\\DeliveryController@makeOva');
$app->get('make-vast', ['as' => 'makeVast', 'uses' => 'App\\Http\\Controllers\\DeliveryController@makeVast']);
$app->get('track', 'App\\Http\\Controllers\\DeliveryController@trackEvent');
$app->get('vast', 'App\\Http\\Controllers\\DeliveryController@adsProcess');
$app->get('rt', 'App\\Http\\Controllers\\DeliveryController@retargeting');
$app->get('test-sentinel', 'App\\Http\\Controllers\\DeliveryController@testSentinel');
$app->get('render-vast', 'App\\Http\\Controllers\\DeliveryController@renderVast');
$app->get('get-vast-tag', 'App\\Http\\Controllers\\DeliveryController@getVastTag');
$app->get('conversion', 'App\\Http\\Controllers\\ConversionController@trackingConversion');
$app->get('mapp', 'App\\Http\\Controllers\\DeliveryController@getApiAd');
// use Jenssegers\Mongodb\Model as Moloquent;
// class RT extends Moloquent{
//     protected $table = 'trackings_2015_07';
//     protected $connection = 'mongodb';
// }
//
$app->get('abc', function () {
    $parameters = ["tcp://" . env('REDIS_HOST_CLUSTER', '127.0.0.1')];
    $options = ['cluster' => 'redis'];
    $connection = new Predis\Client($parameters, $options);
    pr($connection->zrange("LatestRequest_104_" . getClientIp(), 0, -1), 1);
});