Cache

Hi, in my application i would like to add cache. The menu items are load from database. So for this which cache is best? I tried fileCache for this. How we can set the cache on application loading time?

Thanks.

Personally i would suggest APC cache component. Its really very good mechanism for caching.:)

I am using it my lots of application and everything is working great so far.

So, i will recommend you to go with APC cache component.else if you can find something better then please share here.So, i will also give it a try. :)

see this link

http://www.yiiframework.com/performance/

When we can implement APC cache in Yii?

Didn’t understand what you are saying ?? :)

Could you please elaborate your question a bit more.so, that i can answer well :)

For using APC cache- Changes needed in Yii. By Apc where the data stores?

i think this article

Will clear you everything. And regarding a installation process i think that article is explaining according to Centos environment.But you are in different environment then you can search it on google accordingly.Its very simple process.

For this in terminal, run




cd /Applications/MAMP/conf/php5.4.4/

sudo yum install php-pecl-apc



but it shows the error like this




sudo: yum: command not found



i am using mac os.

the steps is correct?

Thanks.

MAMP should come with APC, hence there is no need to install it. Anyway, the article codesutra pointed you to is mostly about configuring APC for top performance. If you want to use APC as user cache (i.e. store queries and view fragments in it), only the section "Preparing Yii" will be relevant to you.

Using APC where the data cached?

It’ll be held directly in memory.

In which memory…?

Well, you know … RAM, main memory, whatever you prefer to call it :)

Thanks. How we can refresh the cache? Means check the data after a particular time interval?

Data in the cache is supposed to expire after some time. You can actively clear single entries in the cache via CCache.delete() or clear the entire cache by calling CCache.flush().

I suggest you go and read the section on caching in the Yii guide.