you can implement it in your Controller.php component with which you can access in every controller. I have this in protected/components/ folder. you can write in before action controller. hope this following little code snippet can help you
its like this. you can write in before action so that you can access anywhere in site.
* Controller is the customized base controller class.
* All controller classes for this application should extend from this base class.
class Controller extends CController
public function beforeAction($action)
// Get Facebook sessions to work in IE
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
//you can write something here i'm accessing through out the site.
// get the terms
$this->terms = Model::model()->findByAttributes(array('name'=>'terms'))->value;
well… it depends. If you want to reduce number of calls to remote service to MUST store the data somehow… I mean it is rather only way to achieve what you want, but you should use cache mechanizm with some garbage collector or LRU (least recently used) removing policy to keep the cache from growing infinitely. You could try memcached (it has LRU removing policy) or some cache in database table, where you could periodically remove old records. Avoid file cache as it does not delete unused cache entries.
Session would also work well and there is garbage collector for sessions, but session is loaded every time it is needed not matter if you use all stored data or not, so it is some overhead for request that do not need this data. So if you need that data in EVERY controller and EVERY request (or almost every) - use session.