Which data in cached in yii after enable Yii - caching

I checking out the Schema Cache part of Yii. Then I found the way for enabled via CFileCache and schemaCachingDuration. It is done without any problems. Now I am thinking as I did not specified which components should be cached. So Which part of application, Yii cached after enabled caching (In the way when we did not set any of other cache settings ). It just schema or more ?

By default Yii only caches:
Global state
Translated messages
WSDL files of Web Services
All other cache features (schema caching, data caching, fragment caching, page caching) are only used on demand (i.e. if explicitely enable/use them).

Related

Is it a good way to generate static page for dynamic content in a large website and how to manage the static page properly

I have a website with millions of pages. The content on the page stored in database but the data is not changed very frequently. so for the sake of improving the performance of the wesite and reducing the costs of deployment of web applications, I want to generate the static pages for the dynamic content and refresh the pages if the contents are changed. But I am very concerned about how to manage these large amount of pages. how should I store these pages? Is it possible that it will cause IO problems when the web server handle many requests? Is there any better solutions for this issue? Should I use varnish to handle this issue?
Varnish looks like a very good use case for that. Basically, you wouldn't be generating the full site statically, but incrementally, every time there's new requested content varnish hasn't cached yet.
EDIT to cover the comments:
if all the Varnish nodes are down, you can't get your content, same as if the database is down, or if your load-balancers are down. Just have two Varnish load-balanced for high availability with keepalived for example.
if varnish is restarted, the cache will get cleared, unless you are using Varnish Plus/Enterprise with MSE. It may not be an issue if you don't restart often (configuration changes don't need restarts), since the database still has the data to repopulate the cache.
Varnish has a ton of options to invalidate content: purges for just one object, revalidation, bans to target entire sub-domains or sub-trees, xkeys for tag-based invalidation.
Based on the description, your architecture looks like Webpages --> Services -->Database. The pages are generated dynamically based on the data in the database.
For Example, when you search for employed details, the services hits the database and get the details of employee and is rendered on the UI.
Now,if you create a content and store as webpage for every employee, this solution will not scale. Also, if employee information is changed in the database, you will have a stale data if you are not recreating the page.
My recommendation is the architecture should have a cache server and the new architecture should be like Webpages --> Services --> Cache server> Database. Services should query the database, create a page and store in the Cache. Key for cache should be page URL and value should be the page content. Now, when the URL hits the services, services will get the page from the cache rather than going to database. If the key is not available in the cache, services will query the database and fill the cache with key and value.
"Key is Url of the page. Value is the content of the page which has hidden updated date."
You can have the back-end job or a separate service to refresh the cache when data is updated in the database. Job can compare the updated date in the database vs the date in the cache value and flush the cache if the date is not matching. Job running in the back-end to refresh the cache will run behind the scene and will not impact user or UI performance.

SAPUI5 Browser Caching?

I have been working on offline application of sapui5. I have gone through these two links.
http://scn.sap.com/docs/DOC-45756
http://help.sap.com/saphelp_nw74/helpdata/en/91/f080966f4d1014b6dd926db0e91070/content.htm
But I am still unable to implement cache handling in my application.
My requirement
Even if network is not there the application should load from browser cache.
view , controller and sapui5 library should be cache.
Try to use cache control feature in sapui5 which will store files in caches in browser. You have to include cache control in neo app.json file

Kentico Output Caching issue - content couldn't get updated

I am working with a Kentico site and I have a problem with page output caching.
We have a custom webpart which loads the records from a Bizform's record data and displays those data in a page. The problem is that after giving it several tries, we couldn't figure out the problem why the webpart couldn't get the latest data from the bizfrom data and we suspect it was because of output caching.
We tried to:
Disable webpart output caching in webpart configuration
Disable page output caching in CMSDesk > General > Output Caching
Disable site output caching in Settings > System > Performance
Disable IIS cache for both User-mode and Kernel cache
Create cache dependencies for cms.form|byid| touched key (which I found is not supported in current kentico version)
And going to try create event handler to add touched key on bizform insert event
We encounter a similar problem with Shopping Cart Mini Preview Webpart with Ecommerce.CurrentContext.CurrentShoppingCart which returns different result for service handler (.ashx - gets updated) and for webpart (.ascx - does not get updated)
If you ever experienced these problems, please help.
The last place where it could be cached is the content cache. It can be set either in Settings->System->Performance or at the web part level under System settings section.
Only web parts that utilize the content caching have this section available. (E.g. some repeaters and data source web parts.) It might be a little bit confusing because then there are two sections (System settings and Performance) where you can influence caching. However the Performance section is used to set up the Partial output cache.
Anyway, you should definitely try to check Cache debug to see what is actually cached.
Additional resources:
Deep dive – Kentico CMS Caching
New in 5.5: Caching API changes
Deep dive: Cache dependencies
Kentico caching and cache dependencies explained
ASP.NET Caching Dependencies
I have faced issue similar to second one (with Shopping Cart Mini Preview Webpart) recently. Only web service (.asmx) was used instead of HTTP handler. In my case issue was solved by setting the EnableSession property of WebMethod attribute to true for all the CRUD webservice methods.
[System.Web.Services.WebMethod(EnableSession = true)]
So I think the matter is that handler should be able to access current Session.
In case of HTTP handler you could try to add IRequiresSessionState on the handler declaration to attach it with the session.
I am also using Kentico 8, I see that your Kentico version is older. That might also have impact but I am not sure about that.

How to cache module in CI with HMVC

CI (2.1.3) & HMVC (5.4)
I have tag cloud (/application/modules/tags)
This module displayed in the template as a block — Modules::run('tags')
If I use $this->output->cache(60) in controller, it cache all page (not tag cloud view).
How can I use blocks caching?
There is no way to do it with Codeigniters built in caching, it only allows you to cache full pages. You need to go and get yourself phil sturgeons partial caching library. https://github.com/philsturgeon/codeigniter-cache, this will let you cache whatever you want.
The only downside is that if your not careful, it can be a bit of a pain to maintain as the site grows, so think carefully about when you are going to need to clear various caches.

Symfony built-in cache vs APC

I am going to optimise a symfony (1.4) project by caching.
I don't know what should I use? Is it better to cache whole pages, components, partial using symfony built-in cache or to cache sql results by APC? What are pros and cons for each one?
I would say: use both.
You can use Doctrine_Cache_Apc for all Doctrine queries, and use Symfony cache on complex actions/components.
If you have a CMS, just remember to invalidate the cache so the user will see his editing "live". For example, on a save action in the CMS, you can use sfFileCache::removePattern to delete the cache files,then re-create cache files on-the-fly with sfWebBrowser::get .

Resources