Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#73 2021-02-16 14:03:26
- etc
- Developer
- Registered: 2010-11-11
- Posts: 4,189
- Website
Re: etc_cache: cache trying hard to be smart
Well, here it is. You MUST uninstall etc_static
before. Then install and (re)activate etc_cache
and visit Advanced prefs for basic configuration.
Even if you don’t need static cache and have etc_cache
already installed, you might want to update it for improved admin tab markup.
Offline
#74 2021-02-17 16:12:35
- etc
- Developer
- Registered: 2010-11-11
- Posts: 4,189
- Website
Re: etc_cache: cache trying hard to be smart
jakob wrote #320095:
I’m curious: I get why the txp:tag can’t be added to the filter field in the Extensions » etc_cache panel, but if it were possible to pass the
filter
as an attribute of the tag, like you can withreset
, would the tag-in-tag variant work? My thinking was that the tag-as-attribute would be processed first and the results passed to etc_cache.
Finally, in today’s version one can set filter
on the public side via id/form
-less <txp:etc_cache />
blocks:
<txp:etc_cache reset="article_save">
"article_save":{"ID":<txp:article_id />}
</txp:etc_cache>
will make all subsequent cached blocks in the current article be updated only on this article’s update.
Offline
#75 2021-02-18 13:21:03
- etc
- Developer
- Registered: 2010-11-11
- Posts: 4,189
- Website
Re: etc_cache: cache trying hard to be smart
After many trial and error .htaccess
cycles, I have managed to make static cache work on my plugins site. The lines to add were in my case
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{QUERY_STRING} ^$
RewriteCond /path/to/site/cache/$1 -f [OR]
RewriteCond /path/to/site/cache/$1index.html -f
RewriteRule ^(.*) cache/$1 [PT,L]
RewriteCond %{REQUEST_METHOD} =GET
RewriteCond %{QUERY_STRING} ^$
RewriteCond /path/to/site/cache/$1.html -f
RewriteRule ^(.*) cache/$1.html [PT,L]
where /path/to/site
is the value of $path_to_site
variable from Diagnostics. Now I get ~ 180ms/80ms ratio between dynamic and static pages. Not as much as Varnish could give, but better than nothing.
Offline
#76 2021-02-18 17:15:00
- Vienuolis
- Member
- From: Vilnius, Lithuania
- Registered: 2009-06-14
- Posts: 241
- Website
Re: etc_cache: cache trying hard to be smart
etc wrote #328953:
~ 180ms/80ms ratio
…
better than nothing.
The static pages are rather important for robustness of a website, its fault resistance, for accessibility of hypertext guides, references, books, usually published once.
Offline
#77 2021-02-18 18:08:47
- Vienuolis
- Member
- From: Vilnius, Lithuania
- Registered: 2009-06-14
- Posts: 241
- Website
Re: etc_cache: cache trying hard to be smart
My debut in regex programming :)
Let’s replace the last line of URL Toolkit ID = Textpattern for Hiawatha webserver
Match [^?]*(\?.*)? Rewrite /index.php$1
to
Match [^?]*\/(|index\.php)\?([^?]+=[^?]+) Rewrite /index.php$2
and append it by this rule-set for static delivery:
RequestURI exists Return
Match ^/$ Rewrite /cache/index.html
Match ^/([^?]+)/$ Rewrite /cache/$1/index.html
Match ^/([^?]+[^/])$ Rewrite /cache/$1.html
Still tested on Regexpal.com only, not on a live website.
Offline
#78 2021-02-18 19:08:06
- etc
- Developer
- Registered: 2010-11-11
- Posts: 4,189
- Website
Offline