Rediska

Follow me on twitter…

Configuration and bootstraping

Add Rediska configuration to your application.ini:

autoloaderNamespaces[] = "Rediska" pluginpaths.Rediska_Zend_Application_Resource = "Rediska/Zend/Application/Resource" resources.rediska.namespace = "Application_" resources.rediska.servers.0.host = '127.0.0.1' resources.rediska.servers.0.port = 6379

Many instances

You can specify a few Rediska instances in application.ini and then you can reference their names in other resources configuration:

; Initialize 'default' instance resources.rediska.namespace = "Application_" resources.rediska.servers.0.host = '127.0.0.1' resources.rediska.servers.0.port = 6379 ; 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 = sessions

You can get instances everywhere:

<?php

// Get 'default instance'
Rediska_Manager::get();

// Get 'cache' instance
Rediska_Manager::get('cache');

// Get 'sessions' instance
Rediska_Manager::get('sessions');

?>

Comments

Iulian October 29, 2014 09:51

Hi guys,

Many thanks for your work on Rediska.
There's an issue with with Rediska when reading from the Zend application.ini config file, somehow the default values for resources.rediska.servers.0.host = 'some.redis.node.domanin'
resources.rediska.servers.0.port = 6379
are ignored, I debugged this and it seems the values are received in Rediska/Zend/Application/Resource/Rediska.php but are lost somehow, only works if I set the DEFAULT_HOST in Rediska_Connection.
Any suggenstions on this, am I missing something?
I would really appreciate your support, good day.

Iulian October 29, 2014 09:54

Forgot to mention, I'm using the latest version of Rediska 0.5.10 and the latest version of Zend Framework 1.12.9

Ivan Shumkov October 29, 2014 12:18

Hello,

Can you try:

resources.rediska.instances.default.servers.0.host = "some.redis.node.domanin"
resources.rediska.instances.default.servers.0.port = 6379

Fork me on GitHub