(Yaf >=1.0.0)
Yaf_Registry::set — Add an item into registry
Stores a value in the registry. Setting an already existing name overwrites its previous value.
nameThe name of the registry entry.
valueThe value to store; it may be of any type, including objects.
Example #1 Yaf_Registry::set() example
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract
{
public function _initRedis(Yaf_Dispatcher $dispatcher)
{
$config = Yaf_Application::app()->getConfig()->redis;
$redis = new Redis();
$redis->connect($config->host, $config->port);
/* the connection is now available to the whole application */
Yaf_Registry::set("redis", $redis);
}
}
?>