EzDevInfo.com

Rediska

Full-featured PHP client for key-value database Redis Rediska - PHP client for advanced key-value database Redis

How to create a new instance of a list using Rediska?

I want to create a new instance of a List in Rediska, but it seems to always want to use some global list.

For example, here is the code that I am using to create a new list:

  $firstList = new Rediska_Key_List('newList');
  $firstList[] = "firstList: first element";
  $firstList[] = "firstList: second element";

  $secondList = new Rediska_Key_List('newList');
  $secondList[] = "secondList: first element";
  $secondList[] = "secondList: second element";

  echo "$secondList[0] and $secondList[1]";

It will echo the following: firstList: first element and firstList: second element Presumably, this is because the first argument of the Rediska_Key_List is the same name. I do not need this. I just want to create a new nameless instance. I cannot leave the first argument blank. I would like the script to print the following:

`secondList: first element and secondList: second element`

Thanks!


Source: (StackOverflow)

Redis and PHP (Rediska) intersect on set

I'm trying to do some tricks with a graph (node/edges) dataset. In this case a set of data where person x follows person y (direct relation). I want to load this data (from a mysql table) into redis (have it running). I've chosen to use Rediska because I use PHP and it seems stable.

Rediska has very limited documentation and examples, so I was hoping you guys can help me. I have little to no experience with noSQL, especially the naming conventions (userid:1:follows = 2?).

My questions:

  • how do I load a set of person x follows person y data into a redis data set
  • how do I find the "intersect" (SINTER) and end up with a php array (so I get person X and person Y both follow (a result set) of people))
  • and last not but leasy, how would I 'traverse' this graph data to find a relation: person x -> person y -> person z (person x and person z both follow person y, hence person z is in the result set)

Source: (StackOverflow)

Advertisements

Add additional PHP modules

Winginx iz amazing, but I found, that for some scripts I need additional PHP modules, witch I have not found in Winginx. I need such modules, like: jSON, mCrypt and rediska. All other as far as i understand exists. So how can I add those modules, if it is possible?

Thank you.


Source: (StackOverflow)

Rediska slow getting keys by pattern

Method KEYS (on Rediska named getKeysByPattern()) is very slow. 200 iterations on 10k db takes 20-25 seconds!

For example, keys named like foo:time:*:y:*:m:*:d:*:h:*:i:*:bar_name:*:item_id:*:category_id:*

Its a normal behaviour of redis or rediska php client?


Source: (StackOverflow)

How to correct PHP path for codeIgniter plugin?

I have tried by myself to install Rediska (Redis PHP client) into my codeigniter application, but without any success. I'll get insane amounts of "No such file or directory"-errors when trying to put it into the plugins folder of Codeigniter:

Severity: Warning

Message: require_once(Rediska/Connection/Exception.php) [function.require-once]: failed to open stream: No such file or directory

Filename: Rediska/Connection.php

Line Number: 6

Have anyone succeeded to install Rediska into Codeigniter before me?

From looking at the Rediska install manual, It appears to be a simple and easy drop-in installation: http://rediska.geometria-lab.ru/documentation/get-started/

Since it's only about path-based errors right now, I'll assume that there's should be some handy PHP setting that I can change to make it all work?

Thanks!


Source: (StackOverflow)

Redis error "Connection read timed out" during caching

I have Zend Framework project and I decided to use Rediska as Redis client. Rediska has cache backend adapter for ZF - Rediska_Zend_Cache_Backend_Redis.

I fetch from DB collection of objects and try to save it in cache but get error: Connection read timed out. My example of code:

$rediskaOptions = array(
                    'name' => 'cache',
                    'namespace' => 'Cache_',
                    'servers' => array( 'cache' => array(
                        'host'   => Rediska_Connection::DEFAULT_HOST,
                        'port'   => Rediska_Connection::DEFAULT_PORT,
                        'password' => 'qwerty'
                        )
                    )
        );

$cache = Zend_Cache::factory('Core', 'Rediska_Zend_Cache_Backend_Redis',
  array('lifetime' => NULL, 'automatic_serialization' => true),
  array('rediska' => $rediskaOptions), false, true
);
$cacheId = 'news_main';
if (!($topics = $cache->load($cacheId))) {
    $topics = DAOFactory::getInstance()->getTopicDAO()->fetchTopic(1);
    $cache->save($topics, $cacheId);
}

Size of content after serialization is 26787 bytes. Maybe Redis have size limitations for sending?


Source: (StackOverflow)