Textpattern CMS support forum

You are not logged in. Register | Login | Help

#21 2010-05-07 14:50:31

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

Hi makss,

After playing a little more with this plugin, I have some questions about its usage and best practices.

Suppose I would like to cache some secondary widgets (small boxes of dynamically generated content, on the sidebar).
Suppose also that I use a few forms for managing each form.
So, I’v somethinge like this:

On page template:

<div id="secondary">
<txp:output_form name="widget-A" />
<txp:output_form name="widget-B" />
<txp:output_form name="widget-C" />
</div>

And each form, widget-A, widget-B and widget-C, is something basic, like this:

<div class="widget">
... some TXP tags and conditionals here...
</div>

Now, the question is. Should I get better results by caching the whole column?
Like this:

<div id="secondary">
<txp:aks_cache block="widgets">
<txp:output_form name="widget-A" />
<txp:output_form name="widget-B" />
<txp:output_form name="widget-C" />
</txp:aks_cache>
</div>

Or by caching each widget? Like this:

<div class="widget">
<txp:aks_cache block="widget-A">
... some TXP tags and conditionals here...
</txp:aks_cache>
</div>

Of course, I’m simplifying things a lot, as it may be other things to take into consideration.

For example, I’ve found that it’s not “reliable” to cache a block of TXP tags if there are a few conditionals inside, like if_section, as those conditionals won’t get evaluated after the block is cached. So if serving a block of content on two different situations (ie. two different sections), and that block renders different content depending on the section, then just caching it will get undesired results.

Of course, there is a workaround, and it’s to create unique, URL-dependent, cache-blocks, particularly by using the new block attribute…

So, this are just a few aloud thoughts about my experiences so far with this nifty plugin.

Thanks again.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#22 2010-05-07 17:00:35

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

I’ve found that it’s not “reliable” to cache a block of TXP tags if there are a few conditionals inside, like if_section, as those conditionals won’t get evaluated after the block is cached. So if serving a block of content on two different situations (ie. two different sections), and that block renders different content depending on the section, then just caching it will get undesired results.

aks_cache will work in this case if block’s content is url-sensetive, i.e. at url site.ru/article/first-article and site.ru/about/bio you txp-code returns different results. Than at each page their would be created cache with different id – like it works at my site.


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#23 2010-05-07 17:21:29

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

Yes, Victor, you are right. In fact, I also said:

Of course, there is a workaround, and it’s to create unique, URL-dependent, cache-blocks, particularly by using the new block attribute…

I wonder also if there may be any issues (particularly, destroying the space-time continuum) if nesting aks_cache blocks. For example, caching each widget, and also, in some templates, caching a whole div that contains all those already cached widgets.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#24 2010-05-07 17:56:30

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

In fact, the only issue will be if you have user-generated stuff and you will cover this if with aks_cache. For example, looking for browser and giving different content – you should place aks_cache in this case inside browser checking, otherwise you will show ever content generated for old visitor with his own browser.

At on of my sites i placed aks_cache everywhere i saw complex db-queries or complex php-scripts. As result – querytime downs from 0.7 to 0.2 sec, and php-generation time downs from 0.8 to 0.3 sec. And i have some more places where to save more time – but this parts of code are rather complex-generated…


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#25 2010-06-29 08:17:20

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

New version aks_cache 0.2.6

Changes:

  • Add attribute disable
  • Add tag <txp:aks_cache_disable /> It’s used inside <txp:aks_cache></txp:aks_cache> block. Any cascade with txp:output form or other plugins for include form is allowed.

Last edited by makss (2016-01-16 18:53:35)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

#26 2010-07-01 07:02:24

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

Small update aks_cache 0.2.7

Changes:

Added option: “Disable cache for users”

Last edited by makss (2016-01-16 18:53:57)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

#27 2010-07-20 14:32:38

ploinkr
Member
From: Montreal
Registered: 2007-12-06
Posts: 83

Re: aks_cache: Partial caching web pages. SpeedUp your site!

Thanks makss! Just a quick question: will it work with TXP 4.0.8?

Offline

#28 2010-10-30 00:55:37

feragnoli
Member
From: the hague
Registered: 2005-02-10
Posts: 150

Re: aks_cache: Partial caching web pages. SpeedUp your site!

hello, thank you very much for this plugin, it’s very useful.
I have been experiencing some trouble, though.
I am caching a block containing a large gallery of images loaded from flickr.
I am not sure whether it is a timeout problem but what I get from the server is the following:

Tag error: <txp:aks_cache id='article <txp:article_id /> cache'> -> Textpattern Warning: MySQL server has gone away insert into claraaks_cache set hid='87210da0926103e97e8c6d28e706c5cb', ttl=1288413881, data='\n

… here follows the data to cache …

', infos='article 1 cache|240|8722' on line 85

I guess there’s a limit somewhere..?
thanks

Last edited by feragnoli (2010-10-31 00:34:41)


what was that again…?

Offline

#29 2010-10-30 19:17:57

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: aks_cache: Partial caching web pages. SpeedUp your site!

What size has chunk of code what you are trying. There is some mysql restriction that it can’t insert via php big parts – i had problem with inserting 2..3Mb code via aks_cache.


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#30 2010-10-31 00:38:55

feragnoli
Member
From: the hague
Registered: 2005-02-10
Posts: 150

Re: aks_cache: Partial caching web pages. SpeedUp your site!

not sure about the size of it.
but IF it is caching the images too that must be a few Mb for sure. is there a way out of this? filesystem caching?
(where is the plugin saving the cache by the way?)


what was that again…?

Offline

Board footer

Powered by FluxBB