Thursday 15 April 2010

php - Predis - how to use array with zadd function? -



php - Predis - how to use array with zadd function? -

i've started using predis redis migration , i'm having problem getting zadd function work array.

this code works:

foreach ($userindexarr $row) { $usernames[] = 0; $usernames[] = $row['username']; $result = $this->cache->zadd('@person', 0, $row['username']); }

this doesn't:

foreach ($userindexarr $row) { $usernames[] = 0; $usernames[] = $row['username']; } seek { $result = $this->cache->zadd('@person', $usernames); } grab (exception $e) { echo 'caught exception: ', $e->getmessage(), "\n"; }

and no error thrown. help much appreciated!

-j

try below, according source: https://github.com/nrk/predis/blob/v1.0/src/command/zsetadd.php

foreach ($userindexarr $row) { $usernames[$row['username']] = 0; } seek { $result = $this->cache->zadd('@person', $usernames); } grab (exception $e) { echo 'caught exception: ', $e->getmessage(), "\n"; }

untested, though. think works, long you're using v1.0 =)

php caching redis predis

No comments:

Post a Comment