-
Release Rediska 0.5.5
April 2, 2011
-
I apologize for the long silence since the last release. I'm not dead, and not in jail, but I spent all this time on our two new projects:
- TimeRanger - nice PHP profiler for production servers.
- Beseda (alpha version) - fast, well designed and featured Node.js Pub/Sub server based on patched Socket.io. Beseda offers server-side and client-side crossbrowser API for realtime messaging.
Ok, back to Rediska 0.5.5. What's new?
- Profiler!
- Watch and unwatch for transactions.
- Moved all command to new binary safe protocol.
- Implemented new string commands: SETBIT, GETBIT, SETRANGE, GETRANGE, STRLEN.
- Implemented new list commands: LINSERT, LPUSHX, RPUSHX, BRPOPLPUSH.
- Added Rediska#removeServer.
- Deprecated old expire behavior.
- Added optional response iterator for sets, sortedsets and lists with realtime reading from socket.
- Added timeout argument to Rediska_Monitor#getCommand and Rediska_PubSub_Channel#getMessage.
- Removed case insensitive from options.
- Set connection to blocking mode if only one connection in Pub/Sub channel.
- Change Rediska_Key_Set to Rediska_Key_SortedSet in Zend Framework session save handler for optimization.
- Autoloader optimization.
- Added Rediska_Key_SortedSet#getByRank method.
- Added Rediska_Key_Hash#getFieldsAndValues.
- Added Rediska_Key_Set#getValues and Rediska_Key_List#getValues.
- Added expire argument to Rediska_Key#getOrSetValue.
- And many fixes.
Highly recommend upgrade your Rediska!
-
Rediska 0.5.5-rc on github!
March 1, 2011
-
Rediska 0.5.5-rc on github at master branch.
We need a few days for test it on production and document new features.
See changelog.
-
Release Rediska 0.5.1
October 28, 2010
-
This is minor release with some fixes:
- Implemented ZCOUNT
- Added append and substring commands to Rediska_Key
- Added setAndExpire command to Rediska_Key
- Fixed warnings about empty namespace
- Fixed GET parameter in sort command
-
Release Rediska 0.5.0
September 21, 2010
-
Last week we launched new version of Rediska and tested it with new Redis server in out projects. Now we can say everything works great and we're announcing it to the public!
Here's what's new so far:
- Implemented Hash commands and Hash key object
- Transactions (MULTI, EXEC, DISCARD)
- Publish/Subscribe (SUBSCRIBE, UNSUBSCRIBE, PUBLISH)
- Implemented BLPOP and BRPOP
- Implemented SETEX, APPEND and SUBSTR
- Implemented CONFIG and MONITOR
- New serialzier. phpSerialize and json adapters. Rediska now can't serialize strings.
- Instance manager
- PhpDoc documentaion
- Refactor commands
- Autoloader
- Add read timeout to connection
- Method generator for IDE autocomplete and phpDoc
-
Added Rediska instance manager and refactored a lot
August 25, 2010
-
Last week I pushed Rediska instance manager and a lot of other changes to github.
Instance manager
There can be different components (cache, sessions and etc) in you application, which may need their own Rediska instance with specific options (namespace, servers and etc).
Manager class is designed to store these Rediska instances. Manager can also store an array of Rediska options and Rediska instance will be created on a first request (lazy-loaded).
There are two new options in Rediska:
- name - instance name. It will be default if other is not specified
- addToManager - whether or not to add Rediska instance to manager when it's created. Defaults to true
<?php // Create 'default' instance $rediska = new Rediska(); // Get 'default' instance from manager $rediska = Rediska_Manager::get(); print $rediska->getName(); #=> default // Create 'cache' instance $rediska = new Rediska(array('name' => 'cache', 'namespace' => 'Cache_')); // Get 'cache' instance from manager $rediska = Rediska_Manager::get('cache'); print $rediska->getName(); #=> cache // Add 'sessions' instance though options Rediska_Manager::add(array('name' => 'sessions', 'namespace' => 'Sessions_')); // Object created when it needed $rediska = Rediska_Manager::get('sessions'); print $rediska->getName(); #=> sessions ?>
Key objects
I sligtly changed constructors of Rediska_Key, Rediska_Key_List, Rediska_Key_Set, Rediska_Key_SortedSet, Rediska_Key_Hash. Second argument became an array of options:
- expire - Expire time
- expireIsTimestamp - Expire time is timestamp (in seconds). For default false
- serverAlias - Server alias or connection object
- rediska - Rediska instance name, Rediska object or Rediska options for new instance. default if not specified
<?php // Create 'cache' instance $rediska = new Rediska(array('name' => 'cache')); // Create key with rediska 'cache' instance $cache = new Rediska_Key_Hash('cacheKeyName', array('rediska' => 'cache')); // Or pass Rediska object to 'rediska' option $cache = new Rediska_Key_Hash('cacheKeyName', array('rediska' => $rediska)); // Or pass Rediska option to create new instance $cache = new Rediska_Key_Hash('cacheKeyName', array('rediska' => array('namespace' => 'Cache_'))); ?>
Zend Framework integration
Now you can specify a few Rediska instances in a application.ini and you can reference their names in other resources configuration.
; Initialize Rediska cache instance resources.rediska.instances.cache.namespace = 'Cache_' resources.rediska.instances.cache.servers.0.host = 127.0.0.1 resources.rediska.instances.cache.servers.0.port = 6379 resources.rediska.instances.cache.servers.1.host = 127.0.0.2 resources.rediska.instances.cache.servers.1.port = 6379 ; Initialize Rediska sessions instance resources.rediska.instances.sessions.namespace = 'Sessions_' ; Initialize cache resources.cachemanager.redis.frontend.name = Core resources.cachemanager.redis.backend.name = Rediska_Zend_Cache_Backend_Redis ; Reference to Rediska 'cache' instance resources.cachemanager.redis.backend.options.rediska = cache resources.cachemanager.redis.backend.customBackendNaming = true resources.cachemanager.redis.frontendBackendAutoload = true ; Initialize sessions resources.session.saveHandler.class = "Rediska_Zend_Session_SaveHandler_Redis" ; Reference to Rediska 'sessions' instance resources.session.saveHandler.options.rediska = sessionsRediska_Autoloader и Rediska_Commands
Autoload and command manager are in separate classes.
All Rediska commands in your IDE autocomplete
There is a script scripts/add_command_methods.php which generates Rediska command methods in following classes Rediska, Rediska_Pipeline, Rediska_Connection_Specified, Rediska_Transaction. This way IDE autocomplete and phpDocumentator will work properly.
-
Rediska config and monitor on github!
August 11, 2010
-
Yesterday I pushed implementation of CONFIG and MONITOR Redis commands to github.
Config
<?php $rediska = new Rediska(); $config = $rediska->config(); // Iterate all redis parameters foreach($config as $name => $value) { print "$name => $value\n"; } // Get parameter print $config->maxmemory; // or as array print $config['maxmemory']; // Get parameters by pattern foreach($config['max*'] as $name => $value) { print "$name => $value\n"; } // Set parameter $config->maxmemory = 10000; // or as array $config['maxmemory'] = 10000; ?>
Monitor
<?php // Get monitor $monitor = new Rediska_Monitor(); // or from Rediska $rediska = new Rediska(); $monitor = $rediska->monitor(); // Get commands foreach($monitor as $timestamp => $command) { print "$timestamp => $command"; } ?>
-
Append, Substring and SetAndExpire already on github!
August 9, 2010
-
New Redis 2.0 commands implementation on github:
- Rediska#Append($name, $value) - Append value to a string key
- Rediska#Substring($name, $start, $end = -1) - Return substring of string key
- Rediska#SetAndExpire($name, $value, $time) - Set + Expire atomic combo.
-
Hashes implemented!
August 2, 2010
-
Let me introduce you Hashes implemented in Rediska:
<?php $user = new Rediska_Key_Hash('users:1'); // Fields accessible as object properties $user->firstName = 'John'; // Fields accessible as array keys $user['lastName'] = 'Silver'; // You can check if field is set if (!isset($user->nick)) { // You can set several fields at a time $user->set(array('nick' => 'Josi', 'confirmed' => 1, 'viewed' => 3)); } // You can remove fields unset($user->confirmed); // You can get fields count count($user); // You can increment field's value $user->increment('viewed'); // You can iterate fields foreach($user as $field => $value) { print "$field => $value"; } // You can create models extending Rediska_Key_Hash class User extends Rediska_Key_Hash { public function __construct($id) { parent::__construct("users:$id"); } public function isAdmin() { return $this->role == 'admin'; } } $user = new User(1); if ($user->isAdmin()) { print 'Welcome ' . $user->login; } ?>
Rediska Hash commands:
- Rediska#setToHash($name, $fieldOrData, $value = null, $overwrite = true)
- Rediska#getFromHash($name, $fieldOrFields)
- Rediska#incrementInHash($name, $field, $amount = 1)
- Rediska#existsInHash($name, $field)
- Rediska#deleteFromHash($name, $field)
- Rediska#getHashLength($name)
- Rediska#getHash($name)
- Rediska#getHashFields()
- Rediska#getHashValues()
-
Publish/Subscribe implemented!
July 27, 2010
-
Today with Yuri Bogdanov I pushed to github Publish/Subscribe implementation.
Some usage examples:
<?php // Subscribe to channel $rediska = new Rediska(); $channel = $rediska->subscribe('channel'); // Gets messages in an endless loop foreach($channel as $message) { print $message; // Exit from loop if needed if ($message == 'exit') { break; } } // Subscribe to few channels with timeout $channels = $rediska->subscribe(array('channel', 'channel2'), 60); // Gets messages for 1 minute and leaves the loop foreach($channels as $channel => $message) { print "$channel: $message"; // Unsubscribe from channels if needed if ($message == 'unsubscribe') { $channels->unsubscribe('channel2'); } // Subscribe to channel if needed if ($message == 'subscribe') { $channels->subscribe('channel3'); } } // Another way to subscribe to channel $channel = new Rediska_PubSub_Channel('channel'); foreach($channel as $message) { print $message; } // Publish to channel $channel[] = 'message'; // Other way to publish $rediska = new Rediska(); $rediska->publish('channel', 'message'); // Or publish to few channels $rediska->publish(array('channel', 'channel2'), 'message'); // Extend channel for you own model class Chat extends Rediska_PubSub_Channel { public function __construct() { parent::__construct('chat'); } public function say($nick, $message) { $this->publish(array($nick, $message)); } } // Read messages $chat = new Chat(); foreach($chat as $nickAndMessage) { list($nick, $message) = $nickAndMessage; print "$nick say: $message"; } // Write messages $chat = new Chat(); $chat->say('John', 'Hello!'); ?>
-
Blocking list pop and shift commands
July 21, 2010
-
I've just pushed two new Rediska commands to github: popFromListBlocking($timeout = 0) and shiftFromListBlocking($timeout = 0) implementing BLPOP and BRPOP Redis commands.
-
Refactoring Rediska commands
July 19, 2010
-
Dear friends, I refactored Rediska commands and pushed to github, namely Rediska_Command_Abstarct class. If you inherit your own commands from it, please pay attention.
-
Rediska transactions
July 15, 2010
-
Few minutes ago i'm pushed to github new feature - transactions.
It's very useful implementaton of MULTI/EXEC Redis command:
<?php $rediska = new Rediska(); $rediska->transaction()->set('a', 1) ->get('a', 1) ->delete('a') ->execute(); // or $transaction = $rediska->transaction(); $transaction->set('a', 1); $rediska->get('a') // #=> null $transaction->get('a', 1); $transaction->delete('a', 1); $transaction->set('b', 2); $rediska->get('b') // #=> null $transaction->execute(); $rediska->get('b') // #=> 2 // You may discard transaction $transaction = $rediska->transaction(); $transaction->set('a', 1) ->get('a', 1); ->delete('a', 1); if (/* something wrong */) { $transaction->discard(); } ?>
Oh! Important feature of transactions - all commands executed as one atomic operation!
-
New serializer and autoloader
July 13, 2010
-
We have some changes on github for you:
- Rediska now serialized only objects and arrays. Strings stored as is.
- Serializer now works with adapters. For define adapter use serializerAdapter option. In a box we have three adapters:
- phpSerializer
- json
- toString
- Rediska now use autoloader and can't required include_path
-
Release Rediska 0.4.2
April 21, 2010
-
We felt uncomfortable about Rediska not supporting commands of unstable Redis versions. This release is devoted exactly to such commands.
Here's what's new so far:
- Added Redis server version specification
- Implemented ZRANK and ZREVRANK
- Implemented WITHSCORES argument for ZRANGEBYSCORE
- Implemented ZREMRANGEBYRANK
- Implemented ZUNION and ZINTER
- Implemented SORT command as standalone
- Deprecated sorting attributes in GetList and GetSet
- Refactored configuration of test suite (now requires Zend Framework)
- Limit and offset broke negative range selects (arguments changed for getList, getSortedSet, truncateList, getFromSortedSetByScore)
- If sessions set is empty trown exception
- Null lifetime not supported in cache backend
Coming soon:
- Hash commands and Rediska_Key_Hash wrapper
- Implementation MULTI, EXEC and DISCARD commands
- Implement SUBSCRIBE, UNSUBSCRIBE, PUBLISH, PUNSUBSCRIBE and PSUBSCRIBE
- CodeIgniter framework integration
-
Release Rediska 0.4.0
April 2, 2010
-
Good news every one! We worked hard and made this world better!
Long story short, heres what we have done:
- ReTwitter (demo application) - small twitter clone based on Zend Framework and Rediska
- Rediska PEAR package
- Symfony integration
- Optimized consistent hashing performance (more then 10 times faster!). Thanks to Kijin Sung.
- Implemented commands: BGREWRITEAOF, ZINCRBY, ZREMRANGEBYSCORE, SLAVEOF, EXPIREAT
- Added WITHSCORES argument supprt to ZRANGE
- Added timeout for connections
- Optimized fromArray method for Rediska_Key_List, Rediska_Key_Set, Rediska_Key_SortedSet
- New test suite
- Throw exceptions if empty arguments
- Throw exception if connection not found
- on method now recieve Rediska_Connection
- Specify connection alias for key objects, so you can explicitly set where this key should be saved
- Added getScoreFromSortedSet method to Rediska_Key_SortedSet
- Refactored Rediska_Connection
- Fixed QUIT bug.
- Zend Session save handler thrown exception on Rediska options
- Add README and CHANGELOG
Well that's what we've got for this release so far, the weekend is here and we're moving to the bar :)
-
"Redis PHP Introduction" by Kevin van Zonneveld
April 2, 2010
- Kevin wrote a nice article about Redis and Rediska friendship.
-
Moved to GitHub
1 comment
March 9, 2010
- Rediska moved to github.
-
Rediska overview on highload.com.ua
January 29, 2010
-
Rediska overview on russian at highload.com.ua.
-
Great Rediska 0.3.0 release
January 22, 2010
-
Congratulations! Rediska 0.3.0 is out:
- Full support Redis 1.2.0 API
- Pipelining
- Operate with keys on specified (by alias) server
- Specify DB index in server config
- Easy extending Rediska by adding you own or overwrite standart commands
- Lazy loading
- Full documentation
- Bug fixes and more
Soon:
-
Release Rediska 0.2.2
November 27, 2009
-
Good news! Rediska is now under New BSD license!