Symfony built-in cache vs APC - caching

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 .

Related

Workbox Routing / Caching / Deletion / Updation and service worker registration?

I have couple of questions regarding service worker and workbox.
1) When to register a service worker in webapp.
* If I register directly in index.html, if I have precache assets then
in first paint the precache assets are downloading twice once with
request and once wit workbox which is delaying the first paint.
* If I register onload of page the issue is getting resolved but if I
have api hits which are to be cached it is getting cached on second
time refresh of the page.
2) In my webapp we use lot of 3rd party js,css,gif and soon. So in my routing if i want to cache them for each request if register a router it seems to be complex, so tried using regex patterns, So could any one suggest best regex to cache them if I need to exclude some image formats from caching. So the best way to cache third party js,css, api hits and so on other formats.
3) The best way to clear the cache, one is to use the expiration and all. But in my case if user changes his location I need to clear some cache contents, So how can I achieve this.
4) When to use caching and when to use indexeddb ?
5) Advantages of using workbox-webpack plugin then directly workbox. Any major advantages ?
6) Best practices for Registering/ unregistering/ updating service worker?
7) If I use workbox-webpack plugin and dynamic route to cache the js/css file so for every build changes a js/css file with different hash is being generated and its getting cached, So service worker caching the samefile with different hash values.
8) The best approach to forcefully delete a cache name and single file in cache.

How to programmatically clear a cached View in Drupal 7?

In Drupal 7 Views 3 how do I programmatically clear the cache of a view I've created?
I don't want to clear all caches or even all views caches, just a specific view.
Thanks!
Try this:
cache_clear_all('field:node:' . $node->nid, 'cache_field');
You may delete it from database or use Drupal Cache API.
Here you have info about many different ways to clear cache.

Which data in cached in yii after enable Yii

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).

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.

Magento - APC Caching, weird basket behaviour

Has anyone ever noticed any weird behaviour with regards to the shopping cart in magento when apc caching is enabled?
I have a situation where it looks as though extra items and/or different items are being added when the user adds something.
Its very strange and aparantly random but only seems to occur when we have apc enabled.
This answer touches on what might be going on:
Memcached vs APC which one should I choose?
Simply move to memcache and your troubles should be resolved.
You may want to try and clear APC's cache, both system cache and user cache.
Note that there is a difference between regular APC cache from CLI and Web based entries, and from what I've gathered you can't simply call it from CLI it has to be from a web request like so:
system('wget --spider --quiet http://localhost/apc/clear_apc_cache.php');
clear_apc_cache.php would contain:
apc_clear_cache('user');
More details:
http://php.net/manual/en/function.apc-clear-cache.php
and note the Cache type Parameter:
If cache_type is "user", the user
cache will be cleared; otherwise, the
system cache (cached files) will be
cleared.

Resources