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.
Related
I want to make an MVC 5 app that will allow users to customize views/pages, create new ones. On the custom pages they can set-up widgets and be able to save the views. Also they should be able to setup the default view that will be loaded by default.
Any ideas how can I achieve this? I believe the views should be saved in the database.
EDIT:
I found this template engine RazorEngine. This seams to be what I am looking for. Anybody has any experience using RazorEngine?
I think you should try some CMS like dotnetnuke etc. other wise build your own framework for all the things so that it can save and fetch your details to and from database.
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 .
I'm trying to implement caching in code igniter. I'm completely new to this so it might be a dumb question but lets see if there's an answer out there.
I've gone to database.php and enabled caching and placed my path. I believe the path is fine because my delete all files call removes the index.html and the htaccess file from that folder. However nothing gets cached as I use the app. I've tried to turn cache on using $this->db_cacheon() but nothing seems to write any files to that folder. My setup is that I have models to handle the connection to the database table in question. So inside of that model I would do a select from tablename and try to have that cached but nothing seems to happen. Does anyone have an idea what I could do to fix this?
There are three types of caching. I don't know much about database caching. I have done output caching.
$this->output->cache(n);
Whatever page you want to cache,
you can use this in controller function which loads your view page.
You can find your cache pages in system/cache folder.
Do you mean $this->db->cache_on()
Have a look at the manual:
http://codeigniter.com/user_guide/database/caching.html
http://codeigniter.com/user_guide/libraries/caching.html
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.
Express has a builtin cache mechanism, set up with app.enable('view cache'). But how do you discriminate between views which should be cached and views which should always be served fresh?
I don't know the details, but I think it caches everything. What I mean is that it puts all views inside memory. I don't think you should discriminate between views and should just cache all views. If you don't want this, you could just do the caching yourself by putting them in memory or Redis or something.
But I would advice you to fill issue at Github. I bet TJ will response to that at Github, but does not read this, because at Github he gets email and Stackoverflow he does not.
Views which are mutable should not be cached; only views which are static should be cached. It's up to your application to determine which is which.