Trying to configure Zend_Cache_Backend_Memcached via a config.ini or config.xml file. I'm not sure how to represent the array of servers in an ini file as described in the documentation
A:
You can probably put this information in the Zend_Registry. If that isn't loaded early enough in the processes, then you can put a big array
declaration in a php file, and require_once
it where needed.
Dana the Sane
2009-08-19 20:27:56
I want to keep all my configs in one place. Specifically in a ini or xml file.
Akeem
2009-08-19 20:32:54
You can keep your configuration in a single place with either approach. With larger projects though, it's advisable to keep the scope of your config files narrow because some code may not need all settings.
Dana the Sane
2009-08-19 23:28:25
There is no need to put this information in the registry, you should use the app config for such things, (you can use a php array instead of ini format and get advantages like APC caching see http://dasprids.de) bit putting this in the app config makes sense. I would suggest creating a custom resource plugin, which can then register your cache object in the registry, or use your own singleton implementation to fetch multiple front/backends throught your app.
Bittarman
2009-08-20 07:39:02
This isn't much different than my second suggestion. If you feel the question is lacking in detail, feel free to expand on it in an answer of your own.
Dana the Sane
2009-08-20 15:43:26
+1
A:
The standard way to represent an array while using Zend_Config_Ini
is to just make some nonsense keys:
cache.backend.memcache.servers.foo.host = host1.example.com
cache.backend.memcache.servers.foo.port = 11211
...
cache.backend.memcache.servers.bar.host = host2.example.com
cache.backend.memcache.servers.bar.port = 12345;
jason
2009-08-19 22:34:32
useful names might help more than nonsense keys, like some hint to which server it is, but this is pretty much on the money
Bittarman
2009-08-20 07:36:03
Yes, I completely agree that for a self-explanatory config file, useful names are must; however, the key names have no tangible impact on `Zend_Cache`
jason
2009-08-20 08:10:49