Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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
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
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
Offline
Re: etc_cache: cache trying hard to be smart
I am trying hard to be smart – but just can´t get there.
(@etc wanted to write you back but end up beeing blocked as spam)
I first tried it with etc_static (because I need static files for what I try to achieve).
Then I was told etc_static ist obsolete and I should work with etc_cache instead.
Now I think there are multiple things going wrong. I am not sure if my whole setup (textpattern inside a shopping system in its own subdirectory) manipulates the cache folder in an unwanted way.
But let´s keep that aside for a moment to not complicate it.
First of all I am wondering how etc_cache is really a substitution for etc_static in my case. I cannot figure out how etc_cache is generating static files. All I can see is that it stores the cache in the database. That is my first issue I would like to solve. Is there a misunderstanding of some kind?
Offline
Re: etc_cache: cache trying hard to be smart
To give it a try I changed my setup so that the cache can be served from the database.
That almost works but I am experiencing similar issues than before.
When I work with {“article_saved”:{“Section”:“my_section_name”}} sometimes the cache is flushed and sometimes it doesn´t. On my page I have a fixed article and some live articles. All of the same section. Changing the fixed article always seems to get the desired behaviour. Changing the live articles results in flushing the cache sometimes and sometimes not.
Sometimes etc_cache from out of nothing tells me “no cached items are recorded”.
When I click on “Update” on a line in the cache panel it resets the filter and reset entries. Is that the idea behind the button “update” ?
It is so weird. It would be great of someone could help finding out what is going on.
Last edited by demoncleaner (2021-06-14 06:54:16)
Offline
Re: etc_cache: cache trying hard to be smart
demoncleaner wrote #330456:
(@etc wanted to write you back but end up beeing blocked as spam)
Hi Christian,
that’s weird, no spam report on my end.
First of all I am wondering how etc_cache is really a substitution for etc_static in my case. I cannot figure out how etc_cache is generating static files. All I can see is that it stores the cache in the database. That is my first issue I would like to solve. Is there a misunderstanding of some kind?
IIRC, if etc_static
worked fine, then etc_cache
should work too, but it has few prefs to set. Have you checked whether ‘Enable static cache’ advanced pref is active?
Offline
Re: etc_cache: cache trying hard to be smart
Ok I think I am still missing things.
Have you checked whether ‘Enable static cache’ advanced pref is active?
Where would I find the advanced prefs?
Last edited by demoncleaner (2021-06-14 07:07:13)
Offline
Offline
Re: etc_cache: cache trying hard to be smart
This is where it starts. Maybe my installation is somehow f…. up.
When I go to Advanced options I do not see anything etc_cache related. Just
“php functions enabled…”, “Custom form template types” and “Number of extra perser sweeps”
This is why I was confused and were asking if there is maybe some Advanced options elsewhere that I am not aware about.
Last edited by demoncleaner (2021-06-14 07:12:39)
Offline