队列

<?php
/**
 * php利用redis做队列
 * @author liuxin
 *
 */
class phpRedisQueue{
    ##redis公共类
    static $phpRedis;
    /**
     * 引用redis类
     */
    function __construct(){
        if(is_null(self::$phpRedis)){
            include_once (WWW_PATH."/lib/phpRedis.class.php");
            self::$phpRedis = new phpRedis ();
        }
    }
    /**
     * L_C_48队列
     * @param unknown_type $key
     * @param unknown_type $value
     */
    public function set($key,$value){
        return self::$phpRedis->lpush($key, $value);
    }
    /**
     * 读取队列
     */
    public function get($key){
        return self::$phpRedis->lpop($key);
    }
}

<?php
/**
* php利用redis做队列
* @author liuxin
*
*/
class phpRedisQueue{
##redis公共类
static $phpRedis;
/**
* 引用redis类
*/
function __construct(){
if(is_null(self::$phpRedis)){
include_once (WWW_PATH."/lib/phpRedis.class.php");
self::$phpRedis = new phpRedis ();
}
}
/**
* L_C_48队列
* @param unknown_type $key
* @param unknown_type $value
*/
public function set($key,$value){
return self::$phpRedis->lpush($key, $value);
}
/**
* 读取队列
*/
public function get($key){
return self::$phpRedis->lpop($key);
}
}

 
原文地址:https://www.cnblogs.com/hgj123/p/4390721.html