Git Product home page Git Product logo

rediska's People

Contributors

bmatschullat avatar cheggaaa avatar dmitrygeometria avatar grenzr avatar maximivanov avatar msabramo avatar netweaver avatar nike-17 avatar shumkov avatar shyru avatar till avatar trickeyone avatar zircote avatar

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rediska's Issues

Rediska_Connection_Exception - getStreamContext returning null always

in Connection.php, when calling stream_socket_client(), the last parameter is calling $this->getStreamContext(), which return null always, then happens this error:

Rediska_Connection_Exception' with message 'Can't connect to Redis server on 127.0.0.1:6379

After removed "@" from "$this->_socket = @stream_socket_client("
the warning is this:
Warning: stream_socket_client() expects parameter 6 to be resource, null given

When I removed this parameter from stream_socket_client, it worked!

autoload

Hello, Ivan.

I propose make better usage of autoload. Rename Rediska to Rediska_Env (or smth else, but need prefix Rediska_). I think that better when all files located in one folder

Pub/sub exiting with exception

I'm using new version of Redis, and master branch of Rediska (updated files today)

I noticed that every time I'm pushing message to channel, subscribe script crashed with exception.

PHP Fatal error: Uncaught exception 'Rediska_Connection_TimeoutException' with message 'Connection read timed out.' in /var/www/test/Rediska/Connection.php:226
Stack trace:
#0 /var/www/test/Rediska/Connection/Exec.php(258): Rediska_Connection->readLine()
#1 /var/www/test/Rediska/PubSub/Channel.php(521): Rediska_Connection_Exec::readResponseFromConnection(Object(Rediska_Connection))
#2 /var/www/test/Rediska/PubSub/Channel.php(251): Rediska_PubSub_Channel->_getResponseFromConnection(Object(Rediska_Connection))
#3 /var/www/test/Rediska/PubSub/Channel.php(348): Rediska_PubSub_Channel->getMessage()
#4 /var/www/test/notifications.php(28): Rediska_PubSub_Channel->valid()
#5 {main}

thrown in /var/www/test/Rediska/Connection.php on line 226

Can't understand why this happend, bug in Rediska or maybe something else?

Subscribe code is simple as from Rediska documentation

input validation

I was wondering if we should create something like:

class Rediska_InvalidArgumentException extends Rediska_Exception implements InvalidArgumentException

... and start validating inputs on some methods. I think all the get-methods have a lot of parameters and [sh,c]ould be validated.

Thoughts?

работа с Twemproxy

Есть редис на хосте cache1.com:6379. Поставил Twemproxy на 127.0.0.1:6379, пишет:
Rediska_Connection_Exception' with message 'Can't read from socket. tcp://127.0.0.1:6379

Код:
$options = array(
'namespace' => 'dd_',
'servers' => array(
array('host' => '127.0.0.1', 'port' => 6379),
// array('host' => 'cache1.com', 'port' => 6379),
),
);

$rediska = new Rediska($options);
$rediska->set('XXX', date('Y-m-d H:i:s'));

Кто-то пробывал использовать Twemproxy + Rediska?

Variadic write commands support

Finally many write commands are able to take multiple values! This is the full list:

SADD set val1 val2 val3 ... -- now returns the number of elements added (not already present).
HDEL hash field2 field3 field3 ... -- now returns the number of elements removed.
SREM set val1 val2 val3 ... -- now returns the number of elements removed.
ZREM zset val1 val2 val3 ... -- now returns the number of elements removed.
ZADD zset score1 val1 score2 val2 ... -- now returns the number of elements added.
LPUSH/RLPUSH list val1 val2 val3 ... -- return value is the new length of the list, as usually.

Since Redis ability to process commands faster is not usually related to the time needed to alter the data set, but to the time spent into I/O, dispatching, sending the reply back, this means that now for some applications there is some impressive speed improvement.

Can't read from socket

i'm using rediska in a backgorund process after the update from rediska 0.5.1 -> 0.5.7 the process is loosing the connection - with the following exception "Can't read from socket" in Rediska_Connection->readLine()

unsubscribe error

Example code:

$channel = $this->rediska->subscribe('bets', $sleeptime);
$channel->unsubscribe();

This will cause:

PHP Fatal error:  Uncaught exception 'Rediska_PubSub_Exception' with message 'Can't find connection 'localhost:6379'' in /Users/fern/workspace/golpas2pg/share/PEAR/Rediska/PubSub/Connections.php:167
Stack trace:
#0 /Users/fern/workspace/golpas2pg/share/PEAR/Rediska/PubSub/Channel.php(462): Rediska_PubSub_Connections->getConnectionByAlias('localhost:6379')
#1 /Users/fern/workspace/golpas2pg/share/PEAR/Rediska/PubSub/Channel.php(148): Rediska_PubSub_Channel->_execCommand('unsubscribe', Array)
#2 /Users/fern/workspace/golpas2pg/share/lib/Gp/Casino/Roulette/Daemon/Run.php(184): Rediska_PubSub_Channel->unsubscribe()

If you do not do unsubscribe(), subscribe connection will nor be closed and you will get "too many files open" in several hours (depending on your sleeptime).

Here is the fix on code:

Channel.php:462

        if (!$connection)
            $connection = $this->_connections->getConnectionByAlias($connectionAlias);

Channel.php:471

        if (!$connection)
            $connection = $this->_connections->getConnectionByAlias($connectionAlias);

There was an error because with unsubscribe the channel is removed from arrays with previous line

                    $connection = $this->_connections->removeChannel($channel);

and getConnectionByAlias can not find it (it is already removed).
$connection is returned by methods and there is no need to search for it again.

Errant require_once in PubSub/Channel.php

On line 4 of Rediska/PubSub/Channel.php there is a require_once that is trying to include Rediska.php.

This seems redundant with auto loading - and the path is wrong regardless.

SADD key member [member ...] Support

Like the title says. I can't seem to add multiple members to a set in one command with rediska. I'm not really sure how I would implement it either. I tried to change the serializer to "toString" and that didn't work.

I can not find ZREVRANGEBYSCORE?

why not?
$command = array($revert ? 'ZREVRANGEBYSCORE' : 'ZRANGEBYSCORE',
$this->_rediska->getOption('namespace') . $key,
$min,
$max);
in getFromSortedSetByScore()

Rediska_Serializer_Adapter_Json::unserialize returns same value that was passed in

The Rediska_Serializer_Adapter_Json::unserialize method is returning the same value that is being passed in to be unserialized. Please see below:

Lines 88-97

    public function unserialize($value)
    {
        $decodedValue = json_decode($value);

        if ($decodedValue === null && $value !== 'null') {
            throw new Rediska_Serializer_Adapter_Exception("Can't unserialize value");
        }

        return $value;
    }

The last line should, instead be "return $decodedValue;".

    public function unserialize($value)
    {
        $decodedValue = json_decode($value);

        if ($decodedValue === null && $value !== 'null') {
            throw new Rediska_Serializer_Adapter_Exception("Can't unserialize value");
        }

        return $decodedValue;
    }

REPLY_MULTY_BULK Bug in Command/Abstract.php?

I discovered this when using getKeysByPattern, which serves a REPLY_MULTY_BULK response.
Currently, if there are no matching keys in the response, an empty array is returned for each connection (as defined on line 235 in Command/Abstract.php).

This causes a warning on line 39 of GetKeysByPattern as explode is expecting a string and is instead met with an array.

Perhaps the solution is the following in Abstract.php (line 228):

        case self::REPLY_MULTY_BULK:
            $count = (integer)$data;

            if ((string)$count != $data) {
                throw new Rediska_Command_Exception("Can't convert multi-response header '$data' to integer");
            }

            if ($count) {
                $replies = array();
                for ($i = 0; $i < $count; $i++) {
                    $replies[] = $this->_readResponseFromConnection($connection);
                }

                return $replies;                    
            } else {
                return null;
            }

Hope this helps,

Ryan

Memory leak in Rediska

I'm getting errors in log:
PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in Rediska/Connection.php on line 358.

Earlier I had memory_limit 128Mb and had the same issues.
Any recommendations?

Not allowed memory - for each with set

В множестве Rediska_Key_Set имеется больше 100000 записей.

$set=new  Rediska_Key_Set('myset');

        foreach ($set as $value) 
        {
            //do something
        }

Такой код вызывает ошибку - не хватает памяти для обработки скрипта.
Можно ли "поштучно" перебрать всё множество?

Fatal error: Access to undeclared static property: Rediska::$_writeClosed in Unknown on line 0

I keep getting the following error. It's random though - sometimes happens, sometimes now.

[08-Apr-2010 11:55:38] PHP Fatal error:  Access to undeclared static property: Rediska::$_writeClosed in Unknown on line 0
[08-Apr-2010 11:55:38] PHP Stack trace:
[08-Apr-2010 11:55:38] PHP   1. {main}() /home/till/example.org/www/index.php:0
[08-Apr-2010 11:55:38] PHP   2. Zend_Controller_Front->dispatch() /home/till/example.org/www/index.php:28
[08-Apr-2010 11:55:38] PHP   3. Zend_Controller_Dispatcher_Standard->dispatch() /home/till/example.org/library/Zend/Controller/Front.php:954
[08-Apr-2010 11:55:38] PHP   4. Zend_Controller_Action->dispatch() /home/till/example.org/library/Zend/Controller/Dispatcher/Standard.php:289
[08-Apr-2010 11:55:38] PHP   5. ApiController->postDispatch() /home/till/example.org/library/Zend/Controller/Action.php:517
[08-Apr-2010 11:55:38] PHP   6. Zend_XmlRpc_Server->handle() /home/till/example.org/app/modules/default/controllers/ApiController.php:184
[08-Apr-2010 11:55:38] PHP   7. Zend_XmlRpc_Server->_handle() /home/till/example.org/library/Zend/XmlRpc/Server.php:337
[08-Apr-2010 11:55:38] PHP   8. Zend_Server_Abstract->_dispatch() /home/till/example.org/library/Zend/XmlRpc/Server.php:599
[08-Apr-2010 11:55:38] PHP   9. call_user_func_array() /home/till/example.org/library/Zend/Server/Abstract.php:219
[08-Apr-2010 11:55:38] PHP  10. Model_XmlRpc_User::searchUser() /home/till/example.org/library/Zend/Server/Abstract.php:0
[08-Apr-2010 11:55:38] PHP  11. ez_User->searchUser() /home/till/example.org/app/modules/default/models/XmlRpc/User.php:566
[08-Apr-2010 11:55:38] PHP  12. Zend_Db_Table_Abstract->fetchAll() /home/till/example.org/library/ez/User.php:151
[08-Apr-2010 11:55:38] PHP  13. Zend_Db_Table_Abstract->_fetch() /home/till/example.org/library/Zend/Db/Table/Abstract.php:1321
[08-Apr-2010 11:55:38] PHP  14. Zend_Db_Statement->fetchAll() /home/till/example.org/library/Zend/Db/Table/Abstract.php:1506
[08-Apr-2010 11:55:38] PHP  15. Zend_Db_Statement_Mysqli->fetch() /home/till/example.org/library/Zend/Db/Statement.php:341
[08-Apr-2010 11:55:38] PHP  16. Rediska_Zend_Session_SaveHandler_Redis->__destruct() /home/till/example.org/library/Rediska/Zend/Session/SaveHandler/Redis.php:0
[08-Apr-2010 11:55:38] PHP  17. Zend_Session::writeClose() /home/till/example.org/library/Rediska/Zend/Session/SaveHandler/Redis.php:110

Missing EXPIREAT command

Hey guys - you're probably aware of this already, but this command subset is currently missing from Expire.php.

Thanks,

Ryan

Rediska Session error

Sometimes I find the following error in our error log. I'm using Rediska 0.5.6. I wasn't able to reproduce this error on purpose yet. In a way this should not be possible as Rediska_Zend_Session_Set implements ArrayAccess. Do you have an idea how to resolve this issue?

[30-Nov-2011 12:21:53] PHP Fatal error: Cannot use object of type Rediska_Zend_Session_Set as array in ../libs/Rediska/Zend/Session/SaveHandler/Redis.php on line 137

Null lifetime not supported in cache backend

A lifetime of 'Null' should mean the data never expires. Can I suggest changing the area around line 124 of Rediska/Zend/Cache/Backend/Redis.php to read:

    if ($result && $lifetime) {
        $this->_rediska->expire($id, $lifetime);
    }

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.