I just want to flush cache by variations, for example just flush the cache with variations id 5
I did't find any reference about flush params ..
thanks in advance .
There is no way to flush cache by variation, at least not in any standardized way (implementation would differ for different cache storages, and for some of them this could be impossible). However you can invalidate caches using TagDependency - after calling TagDependency::invalidate() old cache still will be stored in cache storage, but it will be discarded on Cache::get() call.
Related
In what scenarios would it be better to use an update protocol vs an invalidate protocol? Also when would it be better to use an invalidate vs update?
I'm not able to think of any scenarios in which either would be used. If you're going to invalidate a cache line why not just update it at the same time?
Cache invalidation could be on multiple bases. It could be based on time, sliding window, based on other items within the cache or it could be from any data source.
Updating a cache is relatively a more expensive process. Considering what your data source is, it might cost you precious resources for something that would not be needed for some time.
So the question would be as why to invalidate items and why / when should you update them ?
Well, it completely depends on what is your use case. Do you want your items to automatically expire or have a dependency on any item.
When and why do you want to update them is also dependent on your use case. Would you need that item if it has not been accessed for the last 15 minutes or hours ? Why not update it only when it has been invalidated or expired.
In caches there is another concept of Read-Through. It calls for an update of item from your data source if it does not exist in the cache.
My problem is similar to these, but since I am not allowed to comment, I have to ask again:
a) Drupal cache not working (tables empty)
b) Drupal cache tables are empty, not receiving data
I noticed that after I turned off the Boost module and activated the "normal" Drupal cache, cache tables (starting with cache_ in the database) are remaining empty. I read that this might be related to the use of the Memcache module which I used, too. But disabling that module doesn't change anything either.
I also suspected the Elysia Cron module to clear the cache every minute, but a) cache tables are always completely empty and b) system_cron just runs every hour.
Any more ideas what could be wrong?
It seems it did have to do with memcache: I had forgotten to remove the following line from my settings.php:
$conf['cache_inc'] = 'sites/all/modules/memcache/memcache.inc';
After removing/uncommenting it, the cache tables are being filled.
I'm using Saiku and PHPAnalytics to run MDX queries on my cube.
it seems if i run queries it's all good, caching is fine. But if I go for 2 hours and run those queries again - it does not using cache! Why? I need the cache to be saved for a long time! What to do? I tried to add this ti mondrian.properties mondrian.rolap.CachePool.costLimit = 2147483647
But no help. What do to?
The default in-memory cache of Mondrian stores things in a WeakHashMap. This means that it could be cleared at the discretion of the JVM's garbage collector. Most application servers are setup to do a periodical sweep of garbage collection (usually each hour or so). You have to either tweak your JVM's configuration to not do this.
-Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
You can also implement your own cache implementation of the SegmentCache SPI. If your implementation uses hard references, they will never be collected. This is trickier to do and will require you to do quite a bit of studying to get it right. You can start by taking a look at the default implementation and start from there.
The mondrian cache should cache up until the cache is deliberately flushed. That said it uses an aging system to determine what should be cached should it run out of memory to store the data, the oldest query gets pushed out of the cache and replaced.
I've not tried the PHPAnalytics stuff, but maybe they've put some call into the Saiku server to flush the cache on a regular basis, otherwise this shouldn't happen.
I've setup the enterprise library caching counters using Perfmon. However all I can see is number of entries in cache.
COuld someone please help me if there's way to find out the size of the cached object so that I can specify correct value for Max num of items to be cached and removed etc?
Also, what does Missed Caches really means as I see quiet large number of misses although my web application is working as expected. Do I need to worry about this counter?
Enterprise Library Caching does not provide the size of the cache or the size of objects in the cache.
There are various approaches to finding the object size that you could use to try to tune the cache size. See:
Find out the size of a .net object
How to get object size in memory?
A Cache Miss is when an item is attempted to be retrieved from the cache but the key is not found in the cache. Usually when this happens you would add the item to the cache. This is not usually alarming since for a cache with no backing store it will be empty at first so initially you would see cache misses but misses should decrease as the cache is loaded (unless of course items expire and are removed from the cache).
I'm using varnish with
-s malloc,1G"
It's currently 98% full. Once it completely full what will happen?
With it purge?
Maybe purge old images/pages?
Or better yet purge the files with least amount of hits?
It looks like Varnish uses a LRU (least recently used) strategy to remove items from cache when the cache becomes full with things whose TTL (time to live) has not expired (so first remove things whose TTL is expired, if the cache is still full remove things least recently accessed).
See
https://www.varnish-cache.org/trac/wiki/ArchitectureLRU
Note you can watch the n_lru_nuked counter to see the rate at which things are being flushed from the cache due to LRU.