typo3 cache_pages table have huge size - caching

I use Typo3 version 4.5.19 - I have a huge problem with cache_pages table - for page id=1 i have hundreds of records and database size grow higher then 500 M in less then 24 hours.
On this page I have plugin tt_news installed . I also have other different TYPO3 installation with tt_news and for them I don't have this problem . I can't figure out which is the problem.
Have any thoghts what should I do?

Probably you have various GET params that create different cache entries for each view of the same page. If you google for "typo3 cache_pages huge" you will get quite a few results, e.g. someone had a calendar plugin and it generated a page cache copy for each view of the calendar.
There are two caching mechanisms in TYPO3 < 4.6, the newer of which is called caching framework. I'm not sure which you're running on, and how it should help, but it seems related.
Also check your cHash settings; this article might be helpful: http://www.typo3-media.com/blog/chash-caching-typo3.html

I don't think your news plugin is the problem, since this would rather affect the cache_hash table.
A possible problem could be conditions in your TypoScript. If you do a condition like [globalVar = GP:L = 1], note that this will create an additional cache entry in cache_pages. You can see all your conditions at once in the TypoScript object browser.

Related

Kademi - how to set canonicals on a product page

I am trying to set a canonical on a product detail page to prevent duplicate pages of the same URL.
Our client's website has 1375 however search engines are picking up 2890 because the overwhelming majority of pages are being rendered as duplicate such as the below several examples.
Same product example 1:
https://www.waterware.co.nz/store/1-function-hand-shower
https://www.waterware.co.nz/store/FW556
Same product example 2:
https://www.waterware.co.nz/store/1-function-hand-shower-black
https://www.waterware.co.nz/store/FW550BL
Same product example 3:
https://www.waterware.co.nz/store/1-2m-shower-hose-metal-wound
https://www.waterware.co.nz/store/FH112SS
And repeat 1375x.
I have since discovered where the 2nd version of the URL is coming from - its the favourites icon on product detail page - and will begin removing / adjusting these.
However in order to maintain best SEO practices I need to find a way to set a canonical.
I am aware that this could be done MasterTemplate.html. However there does not seem to be a way to discover the correct scope when in the master template file.
Any suggestions?
Thanks
SEO integration was commented out in KCommerce2, but it will be re-enabled in the next release later this week
This uses the webname property in the canonical href.
It also inserts the meta description field using the brief if its available, otherwise the product body.
And it also generates a meta keywords tag, using the product code, categories and brand.
To use this once available, you will just need to update to KCommerce 3.1.3 or later.

Joomla - how can I count all active instances of specific module type?

As the title suggests my question is pretty simple.
Is there a way to count the total number of active module instances of a specific type/kind in Joomla (with a specific module name)?
I know how to count modules in a specific module position using JModuleHelper::getModules, but that is not what I want.
I simply need to count all active modules instances of a specific type/kind.
Does anyone know how to do this (without having to do a manual MySQL query)?
I do not know if there is an official joomla way, but you can do it by having an sql query looking at
#__modules
table.
Check out this table and you will find out how easy it is.
An example sql would be:
select count(id) from #__modules where module = 'mod_login'
As far as i know there is no joomla method for this. I would recommend (if it has to be done) either
using a crawler to go through all pages of the site counting the instances.
or using a script which goes through the template php files and the database to find all active instances.
Both these methods might not be 100% reliable due to unexpected circumstances (like module being included in article or module included only after a button is clicked on) but could work if you know your site well enough.
Unfortunately there does not seem to be such a function in Joomla.
In my case I needed this to tell me whether or not a instances of this module was > 0 or not.. and my alternative solution was to simply make a module-specific function and then in the module php file check if function is already loaded.

Kohana ORM Caching/Caching design approach

This questions is related to Kohana ORM AND Caching module. I use version 3.2 if it matters. I tried to research trust me, but I really couldn't find some good answer... so here it is:
What are the correct ways to use ORM::cached() and ORM::serialize() and ORM::$reload_on_wakeup?
I've seen many 2-line code examples but never anything really solid on the userguide/api...
What is the difference between enabling Cache module and 'caching' => true in Kohana::init?
Anyone has any recommended approach for the following specific situations? I have a catalogue page that upon profiling, I realized two very expensive actions:
I queried database each time for a currency model for each item, when the currency information can really be reused.
I queried database each time for each item's inventory item, this is an expensive query, which I wish I can cache until inventory level changes.
References that I found but couldn't answer fully my questions:
http://forum.kohanaframework.org/discussion/1782/tip-for-caching-orm-objects/p1
http://forum.kohanaframework.org/discussion/10600/does-kohana-orm-and-cache-work-together/p1
Just found your question, maybe too late, but maybe is useful to others:
cached, will force the Query builder to cache the DB query. It uses the KOhana:cache method (file cache) I am trying to find a workaround for this.
enables caching for the file search as says in the Kohana/Core.php file: Whether to use internal caching for [Kohana::find_file], does not apply to [Kohana::cache]. Set by [Kohana::init]
Enable caching true to speed up the file search, and enable the cache module, I am working on a way to cache the queries of DB using the instance used by the module. That would be better than using the file cache. Maybe I am missing something but stuck there right now.

Drupal 7 caching my form and printing old cached fields (Varnish/Memcache)

I have a profile2 form called by drupal_get_form - though after its been edited and saved, the fields still display the old information for awhile. How can I turn caching off here? I'm using memcache/varnish/apc btw.
I'm also printing these fields elsewhere and get the same problem.. I would rather this be dynamic and fresh for just these fields/forms.. any ideas on how to do that? Thanks!
Probably you need to exclude cache_form from memcache with:
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
in your settings.php file

Partial caching dependencies in Kentico

How do I use the partial dependency caching in Kentico CMS?
Here's a very common example need I have but can't figure how to set up partial caching with dependencies correctly (in Portal mode, though I think this should apply to the other development modes too):
/Home (with a Repeater)
/News
Item 1 (so path = /News/Item-1)
Item 2 (so path = /News/Item-2)
The Home page has a Repeater web part that lists the most recent news items. It has a Path of "/%" and Document Types filter set to "CMS.News"; obviously also a "Partial cache minutes" value > 0. There is no custom code; just Portal web parts and standard document types.
What is the exact "Partial cache dependencies" string I should use so that when a third news item it is immediately reflected on the Home page, but otherwise uses the cache?
Kentico did release several blog posts including Deep dive: Cache dependencies, but I'm having difficulty applying the theory discussed there to a site. I even asked in comments there some questions, but the answers by the Kentico support there weren't really helpful.
From what I could tell in that post, they said to use node|%CurrentSite.SiteName%}|/News|childnodes which seems to have some magic keywords like node and some macro elements like {%CurrentSite.SiteName%}. (I know that all items need to be lowercase, so already I know their advice isn't real consistent. It should at least be node|%CurrentSite.SiteName%}|/news|childnodes instead. And do I need to force lowercase on the macros?) First of all, that string didn't work for me--it was still caching the Home page Top News repeater (yes, full page caching was turned off); second, how do I build a string like that and debug what it should be? The linked post does have a grid of examples, but it is confusing (to me) and not exhaustive.
Can anyone provide a good example or better blog post reference anywhere that explains this in another way?
EDIT: I realized I asked this question fairly broadly. How about if we narrow it to just answer the question: How do I determine what settings to use to cache a repeater with a dependency to changes in another folder?
The magic words you mentioned in your post are basically the keywords for particular objects. You can see them listed in the caching options description - the "node", "nodes", "nodeid" are listed there as most common for working with nodes. But below then is described the syntax for any object, where you will use that object class name.
Regarding the blog post from the Kentico's CTO and his answers in the comments, it looks like he overlooked or misunderstood your question. you are talking about partial caching and he was giving you examples on the "normal" caching settings. Macros in the touch keys are resolved (lower case or upper case does not matter) in all other caching settings but not in the partial caching. This feature will be available in the upcoming version 6.0.
So, right now you have to hard-code the site name in the touch key cache setting.
I turned on the cache debugging and looked at what cache names were being generated. I saw mine being set to...
node|{%CurrentSite.SiteName%}|/test-section/|childnodes
...which was obviously incorrect and would never work!
It looks like macros do not get resolved within the Partial Cache Dependencies property. So you can't use "{%CurrentSite.SiteName%}" in place of the site name. Here is an example of a partial cache dependency that worked for me...
node|mytestsite|/test-section/|childnodes
Using the above partial cache dependecy, the cache was refreshed as soon as I deleted a sub-item.

Resources