Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-04-11 11:23:50

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

aks_cache: Partial caching web pages. SpeedUp your site!

Partial caching web pages

Version 0.3b download link / homepage

Summary:

Caching all inside <txp:aks_cache id="unique block id"> Any content with TxP tags </txp:aks_cache>

Good practice:
  • Cache some menu elements; recent articles list; last added articles list; any popular lists.
  • Cache cloud tags
  • Cache site main page or cache some ‘slow’ pages with many TXP tags.
  • Cache output some slow or difficult tags.
Bad practice:
  • Cache static content without TxP(or php include) tags
  • Full cache every page
  • Cache static body every page

Screenshot:

Related:

To freeze random content
Docs and Successful story

Last edited by makss (2017-03-12 13:03:13)


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

#2 2010-04-11 13:46:38

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

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

Brilliant ! Thanks!

Offline

#3 2010-04-13 14:11:24

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

Changes:

  • Extend admin interface

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


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

#4 2010-04-13 23:20:01

paperboy
Member
From: Gothenburg, SE
Registered: 2006-01-24
Posts: 30
Website

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

Just tried this on my “Most Popular” and a “Top Referrers” list on my website and it seems to work like a charm! This + aks_header has made my website faster than ever so… thanks! :D

Offline

#5 2010-04-17 10:29:36

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 278
Website GitHub Twitter

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

I use actually zem_cache and your new plugin seems to be more comfortable to use, but is it possible to distinguish between “global” cache and cache per page?
To clearify: zem_cache had a ‘ctx’ and a ‘id’ parameter

id – Use this if you’re using multiple zem_cache tags per page. Each tag should have a different id. It doesn’t matter what the id is set to – a number is fine – as long as each one is different.
ctx – Use this to cache a single copy of something globally across all pages, rather than once per page. For example, <txp:zem_cache ctx=“recent1”><txp:recent_articles /></txp:zem_cache>

thanks

Offline

#6 2010-04-19 10:30:24

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

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

whocarez wrote:

I use actually zem_cache and your new plugin seems to be more comfortable to use, but is it possible to distinguish between “global” cache and cache per page?
To clearify: zem_cache had a ‘ctx’ and a ‘id’ parameter

aks_cache use one parameter id for “global” or cache per page.

Sample cache two blocks in one page per section:

<txp:aks_cache id='<txp:section />_block1'>
Content block1.
</txp:aks_cache>
Some...
<txp:aks_cache id='<txp:section />_block2'>
Content block2.
</txp:aks_cache>

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

#7 2010-04-19 10:31:53

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

Changes:

  • Add option: “Reset cache if site was updated”

Last edited by makss (2016-01-16 18:51:40)


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

#8 2010-04-24 07:34:24

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

Changes:

  • Add option: “Disable cache for admin”

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


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

#9 2010-04-24 11:28:21

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 278
Website GitHub Twitter

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

I tested aks_cache on my site and discovered, that it is only partly usable for me. Maybe I use the parameters not in the right way.
For example: I used zem_cache to cache “keywords” and “related articles” and also for “meta descriptions”. They are different for every article.
When I put aks_cache with id=“related” in the code, then there is only one cache for “related” articles and it shows these “related articles” under every article which is showed up, so it is not the intentioned use. So, if I used it in the right way, the aks_cache plugin is yet only for global caches usable.

Offline

#10 2010-04-24 13:10:36

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

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

Although I’ve never used the plugin (I’m planning to use it on a current project), you could try something like this:

id='related-<txp:article_id />'.

This way, you will have one cache for each article.
Please, tell us if that works. Thanks :)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#11 2010-04-24 14:01:31

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 278
Website GitHub Twitter

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

Yes! It was obvious, but not for me :-) Makss explained it in the help section <txp:aks_cache id='menu <txp:section />'>, but I overlooked it …

So I could convert all tags <txp:zem_cache ctx="xyz" /> to <txp:aks_cache id="xyz" /> and all <txp:zem_cache id="xyz" /> to <txp:aks_cache id='xyz-<txp:article_id />' />
zem_cache isn´t needed any more … Thanks Makss (дуже дякую)!

Offline

#12 2010-05-06 02:14:05

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

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

hi Makss,
thanks for this plugin. I’m finally trying it and I like it.

However, I’m having some issues, and I’m not yet sure if this is a plugin issue or my fault.

The first issue I encounter is that, for aks_cache blocks where the id is created by using tags-in-tags, the plugin is creating two cache blocks.
For example:

cache block_id ttl(minutes) size(bytes)
noreset-last_tweets 60 727
noreset-otf_css_news 60 134
noreset-otf_css_ 60 126
site_vars_news 60 3
site_vars_ 60 3

last_tweets block is just a cache block created by using id="last_tweets".

On the other hand, otf_css and site_vars are blocks that are suffixed with <txp:section />, like this.

<txp:aks_cache id='site_vars_<txp:section />'>
  <txp:variable name="body_id"><txp:pax_grep from="'-'" to="_">s_<txp:section /></txp:pax_grep></txp:variable>
  <txp:variable name="body_class"><txp:pax_grep from="'-'" to="_">s_<txp:section /></txp:pax_grep></txp:variable>
</txp:aks_cache>
<txp:aks_cache id='otf_css_<txp:section />' noreset="1">
  <!-- On-the-fly styles for highlighting active section -->
  <style type="text/css">
    .<txp:variable name="body_id" /> #nav_<txp:variable name="body_id" /> a {
      color:#95292c;
    }
  </style>
</txp:aks_cache>

As you can see, there is nothing special, just some tags-in-tags in the id attribute.

However, as the above table shows, the cache block is created twice, one suffixed, and the other one not, and with different sizes. The difference in sizes comes from the fact the un-suffixed version is just wrong.
For example, the otf_css_news cache block renders:

<!-- On-the-fly styles for highlighting active section -->
<style type="text/css">
.s_news #nav_s_news a {
color:#95292c;
}
</style>

While the otf_css_ (wrong, un-suffixed) version renders:

<!-- On-the-fly styles for highlighting active section -->
<style type="text/css">
.s_ #nav_s_ a {
color:#95292c;
}
</style>

In the case of site_vars_news and site_vars_ the thing is worst, as it renders empty (as you can see, it only has 3 bytes).

May this be this a bug?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB