CCache.keyPrefix

Dear all,

I’m wondering what is is CCache.keyPrefix useful for ?

Why this is linked to app()->id ?

And how CApplication::id is calculated ?

Thanks

Olivier

Let’s assume you have a memcache-installation and 2 different yii-projects who use this cache. With help of the keyPrefix you can now use the cache-key “test” on both projects. If there where no keyPrefix, both projects would read/write to the same cache-key.

CApplication::id is generated this way:


	public function getId()

	{

		if($this->_id!==null)

			return $this->_id;

		else

			return $this->_id=sprintf('%x',crc32($this->getBasePath().$this->name));

	}

Thanks for this reply. Now, I know how I can define keyPrefix for use in both CConsoleApplication and CWebApplication.