This commit adds a utility method as a counterpart to the _unserialize
utility method, allowing users to manually serialize data themselves
before sending it to Redis. This could be useful for calls going through
EVAL, as phpredis can't automatically serialize/unserialize in that case.
Addresses #431
This commit implements the Redis PUBSUB command, a new command
available since Redis 2.8.0 and described here:
http://redis.io/commands/pubsub
Addresses #427
This commit introduces support for the Redis SCAN, HSCAN, SSCAN,
and ZSCAN commands.
In the case of HSCAN, SSCAN, and ZSCAN, we take a key and iterator
as required arguments, and for SCAN just an iterator. Matching
the Redis commands, each variant can optionally take a pattern
to match against and a count value which hints at Redis how many
keys to return at a time.
When scanning keys or members (especially with a large keyspace when
searching for a pattern), Redis will sometimes return an empty result
of keys/members. PHPRedis can be set up to abstract this from the
caller by setting:
$redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY);
Which instructs PHPRedis to keep retrying the scan until members are
returned OR the iteration completes (Redis returns to us a zero iterator).
By default this option is set to Redis::SCAN_NORETRY, meaning that
empty results are possible, requiring an explicit check for FALSE in the
scanning loop, like so:
```php
$it = NULL;
while(($arr_keys = $redis->scan($it, "*pattern*"))!==FALSE) {
print_r($arr_keys);
}
```
This commit implements the new WAIT command which currently lives
in redis unstable, along with a unit test.
Also added myself to the README.markdown file, as well as a link to
"the twitter".
Implement the new SET options as per the redis documentation:
http://redis.io/commands/set
You can now pass the new options (ex=>sec, px=>milisec, xx, nx) as
an array of options to the SET command and phpredis will handle them.
If you pass key, value, <long> phpredis will still redirect to SETEX
as it did before (to avoid breaking implementations).
Addresses #364
This commit adds methods to get information about the state
of our phpredis object, such as what host/port we are connected
to, our timeout, etc...
The following methods have been added:
getHost()
getPort()
getDBNum()
getTimeout()
getReadTimeout()
isConnected()
getPersistentID()
getAuth()
In addition, there is a small memory leak fix when a persistent id
was specifically passed to connect() (it wasn't beeing freed).
Addresses issue #320
Added an option to let each RedisArray connection connect lazily to
their respective server. This is useful then working with a redis
cluster composed of many shards which are not necessarily in use all at
once.
This commit adds support for the CLIENT commands (list, getname,
setname, kill).
You can call them like so:
$redis->client('list');
$redis->client('getname');
$redis->client('setname', $name);
$redis->client('kill', $ip_port);
Solves issue #300