Giter Club home page Giter Club logo

yiiredis's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yiiredis's Issues

Only variables should be passed by reference

i have promlem

PHP Error[2048]: Only variables should be passed by reference
    in file /var/www/***/app/lib/vendor/codemix/yiiredis/ARedisIterableEntity.php at line 29

php -v

PHP 5.5.3-1ubuntu2.6 (cli) (built: Jul  7 2014 16:54:53) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with XCache v3.1.0-dev, Copyright (c) 2005-2013, by mOo
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
    with XCache Optimizer v3.1.0-dev, Copyright (c) 2005-2013, by mOo
    with XCache Cacher v3.1.0-dev, Copyright (c) 2005-2013, by mOo
    with XCache Coverager v3.1.0-dev, Copyright (c) 2005-2013, by mOo

use:

$user = new ARedisHash('user.'.$userResourceId);
$out[]=$user->toArray();// ->getData()

Wrong default port in example configuration

Really just a very small thing, but after trying out the examples I got this error message "Redis server went away". This is because the default port is 6379, not 6739. You may want to change that :)

ARadisList getCount()

public function getCount() {
    if ($this->_count === null) {
        if ($this->name === null) {
            throw new CException(get_class($this)." requires a name!");
        }
        $this->_count = (int) $this->getConnection()->getClient()->lSize($this->name);
    }
    return $this->_count;
}

lSize does not work

but work this:
$rconn = Yii::app()->redis->getClient();
$llen_f = $rconn->llen($redis_key);

Method Redis::delete() is deprecated

When used to store Yii 1 sessions with Redis 7.2, i receive the error "Method Redis::delete() is deprecated".

/var/www/protected/extensions/YiiRedis/ARedisSession.php(80)
78 public function destroySession($id)
79 {
80 $this->_connection->getClient()->delete($this->calculateKey($id));
81 return true;
82 }

Replacing the delete() with del() fixes the issue

Issue with Database selection in ARedisConnection::getClient()

In class ARedisConnection method getClient() should be,

public function getClient()
{
    if ($this->_client === null) {
        $this->_client = new Redis;
        $this->_client->connect($this->hostname, $this->port);
        $this->_client->select($this->database);
    }
    return $this->_client;
}

This will allow to select different Redis DB from default one; which can be done using following in your main config file,

array(
    ......
    'components'=>array(
        ......
        'redis' => array(
            'class' => 'ext.redis.ARedisConnection',
            'hostname' => '127.0.0.1',
            'port' => 6379,
            'database' => 2, //this will select databse 2 [Redis allows to select upto 16]
        ),
        'cache' => array(
            'class' => 'ext.redis.ARedisCache'
        ),
        .....
    )
);

ARedisChannel bug

$channel = new ARedisChannel("myChannel");
$channel->onReceiveMessage = function($redis, $channel, $message) {
echo "Message Received:".$message."\n";
};
$channel->subscribe();

I can't get the value of $channel, $message

ARedisHash bug

24 line
if (!$this->getConnection()->getClient()->hset($this->name,$key, $value))

it don't corrent than hset return 1 if create new 0 if update exist and return false if error

correct code
if (false === $this->getConnection()->getClient()->hset($this->name,$key, $value)) {

Doc bug

Storing and Retrieving simple keys

Yii::app()->redis->getClient()->set("myKey", "Your Value");
echo Yii::app()->redis->getClient->get("myKey");
Yii::app()->redis->getClient()->rem("myKey");

right way: getClient(), del

flush

In the ARedisCache class, line 118, where is calling:

return (bool) $this->getConnection()->getClient()->flush();

it should call:

return (bool) $this->getConnection()->getClient()->flushAll();

ARedisRecord.php need fix 2 methods

  1. populateRecord

    $record->setScenario('update');
    +$record->setIsNewRecord(false);
    $record->init();

  2. getPrimaryKey

foreach($attribute as $field) {

  • $pk[$field] = $this->{$attrubute};
  • $pk[$field] = $this->{$field};
    }

P.S. I do not speak English

Config-level connection for session (and cache?)

Hi,

I'd like to separate data in different databases, in particular sessions from data, say respectively into database 1 and 2.

I noticed you can instantiate any RedisEntity by specifying a connection, so in principle I can do that. However, I'd find more usable/less error prone to setup the default connection for data, and configure session to use another connection.

A proposal follows, please let me know if you'd like a pull request.
E.

  • changes to ARedisSession.php

    public $connection = null;
    
    /**
     * Initializes the application component.
     * This method overrides the parent implementation by checking if redis is available.
     */
    public function init()
    {
        if ($this->connection !== null)
            $this->setConnection($this->connection);
        else
            $this->getConnection();
        parent::init();
    }
    
    
    - example of main/config.php
    
    ```php
    'redis' => array(
        'class' => 'ext.redis.ARedisConnection',
        'hostname' => 'localhost',
        'database' => 2,
        'port' => 6379,
    ),
    'redis-session' => array(
        'class' => 'ext.redis.ARedisConnection',
        'hostname' => 'localhost',
        'database' => 1,
        'port' => 6379,
    ),
    'session' => array(
        'class' => 'ext.redis.ARedisSession',
        'connection' => 'redis-session',
    ),

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.