Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#49 2021-02-14 08:45:53

etc
Developer
Registered: 2010-11-11
Posts: 4,432
Website GitHub

Re: etc_cache: cache trying hard to be smart

Hi Patrick, have you tested it in live mode and logged out? The second version does not cache pages with ‘no cache’ headers. The next one (integrated into etc_cache) will let you set the cache conditions via its interface.

Thanks for testing!

Offline

#50 2021-02-14 09:50:36

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,481
Website GitHub Twitter

Re: etc_cache: cache trying hard to be smart

Yes. You’re right, Oleg (which makes sense: you are the author of this plugin)! 🤣

Much better than the previous version. I’m going to use it intensively on an in production website (never mind if it will be crashed). 🤪


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#51 2021-02-14 11:11:12

etc
Developer
Registered: 2010-11-11
Posts: 4,432
Website GitHub

Re: etc_cache: cache trying hard to be smart

You are right, updating etc_cache might take time. But it’s in progress:

Offline

#52 2021-02-14 14:41:36

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 180
Website

Re: etc_cache: cache trying hard to be smart

I stumbled over this plugin today and I would like to check if it can solve my problem. I might not have fully understood the principle so please forgive me for some stupid questions.

I am trying to find a way to have some pure HTML pages that are generated by textpattern that I could include elsewhere. (Basically I want to combine textpattern with a shopping system – to not describe the whole thing too much in detail) I thought using the cached files for inclusion could be a good idea.

Then I saw this Textpattern powered websites will now serve visitors as hypertext flat-files, suspended in ‘maintenance mode’, too! from two days ago and though it might be exactly what I need. Flat-files sounds as if it could serve me well.

Now I gave it a try and installed the plugin and I am wondering how I could call the cached files. I fear I am completely wrong and the plugin does not really serve unique processed files that I could use for my inclusion idea.

If that does not work (sorry slightly off topic) is there another way to include textpattern generated output without using “file_get_contents” which I am using now and is not very performant. I hope somebody can push me in the right direction here.

Last edited by demoncleaner (2021-02-14 14:48:01)

Offline

#53 2021-02-14 17:18:46

etc
Developer
Registered: 2010-11-11
Posts: 4,432
Website GitHub

Re: etc_cache: cache trying hard to be smart

demoncleaner wrote #328859:

Now I gave it a try and installed the plugin and I am wondering how I could call the cached files. I fear I am completely wrong and the plugin does not really serve unique processed files that I could use for my inclusion idea.

I think you could use it this way, just keep in mind that

  • it’s a cache, not a ssg, so flat files are created only when someone visits the corresponding page.
  • this ‘someone’ must not be logged in, and the site must be in live and clean mode.
  • pages with ?query URL are not cached, neither those accessed via POST method (typically form data), neither those that send a ‘no public cache’ header.
  • the cached files are (atm) stored in public cache directory. If the original URL is section/title, the cached one will be cache/section/title.html. You can either access it directly or (preferred) by modifying .htaccess file.
  • the whole cache is currently deleted on site update. This will be more granular in the next version.

Hope that helps and don’t hesitate to feedback.

Offline

#54 2021-02-14 19:59:43

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 180
Website

Re: etc_cache: cache trying hard to be smart

Thanks for your description but I am sorry, I still cannot get it running.
Do I have to create a cache folder manually in the root of my textpattern installation?
I did so but even when I am (not logged in) calling the needed URL nothing is written in that directory. Rights are set properly. But of course cache/section/title.html is not working then. I get a 404. What am I missing?

Offline

#55 2021-02-14 20:06:18

etc
Developer
Registered: 2010-11-11
Posts: 4,432
Website GitHub

Re: etc_cache: cache trying hard to be smart

Is your site in live mode? If txp has write permission on the root directory, it shouldn’t be necessary to create the folder. Also, you must access pages via clean URL links.

Edit: isn’t the server sending some Cache-Control or Vary header?

Offline

#56 2021-02-14 20:44:37

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 180
Website

Re: etc_cache: cache trying hard to be smart

etc wrote #328862:

Is your site in live mode?

yes

If txp has write permission on the root directory, it shouldn’t be necessary to create the folder.

Hmm ok weird. After installing the plugin there was no cache directory. So i created one. What happened was that inside this directory automatically a folder “domain.com” and inside that a folder “files” was created. I gave all of them 777 rights but still it was not working.

Also, you must access pages via clean URL links.

You mean in the admin settings it should be on /section/title for example? It is.

Edit: isn’t the server sending some Cache-Control or Vary header?

Sorry. I have no idea on this one…
How do I know if txp has write permission in the root?

Last edited by demoncleaner (2021-02-14 20:48:30)

Offline

#57 2021-02-14 20:51:58

etc
Developer
Registered: 2010-11-11
Posts: 4,432
Website GitHub

Re: etc_cache: cache trying hard to be smart

demoncleaner wrote #328863:

What happened was that inside this directory automatically a folder “domain.com” and inside that a folder “files” was created.

Holly weirdness, what’s this? Is files content related to your txp install?

Offline

#58 2021-02-14 20:55:43

etc
Developer
Registered: 2010-11-11
Posts: 4,432
Website GitHub

Re: etc_cache: cache trying hard to be smart

demoncleaner wrote #328863:

How do I know if txp has write permission in the root?

777 should be ok, but you can also try in some article

<txp:php>var_dump(is_writable('.'));</txp:php>

Offline

#59 2021-02-14 21:00:56

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 180
Website

Re: etc_cache: cache trying hard to be smart

There is nothing in the folder “files”. It is empty.

OK first things first. Do I understand you correctly that normally by installing your plugin it should automatically create a “cache” folder in the root?

Apart from creating the cache folder manually this is what I did:
For testing purpose I wrapped <txp:etc_cache id=“heavycode”> around my “page” and in extension tab I can see that it is caching something there. BUt apart from that and the maybe weirdly creation of the subfolder in my cache directory… nothing happens.

Offline

#60 2021-02-14 21:02:51

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 180
Website

Re: etc_cache: cache trying hard to be smart

etc wrote #328865:

777 should be ok, but you can also try in some article

<txp:php>var_dump(is_writable('.'));</txp:php>...

I get bool(false) when I try this.

Offline

Board footer

Powered by FluxBB