Jump to content

Cache (again) (Generic and TemplateEngineFactory Module)


LimeWub
 Share

Recommended Posts

Hey,

Really getting bugged with ProcessWIre's persistency to cache things constantly... so I'm making a thread on the topic, again :)

 

Couple of Questions:

Question A

Can I temporarily disable ALL cache? By that I mean, getting PW to COMPLETELY ignore assets/cache and just do things on the fly. I don't care if it's slow at all. This is for development only.

 

Question B

Can I force a template file that's not a page, not to be cached?

I have created a "chunk" which is a banner for each page and I want it to have a different title on each page. At the moment it gets cached and the title remains the same after the first page visited. I don't want this. Can I add anything, anywhere to stop it from caching this specific template and it's variables?

I am using TemplateEngineFactory and TemplateEngineSmarty for my templates. Caching is SUPPOSEDLY  turned off in the TemplateEngineSmarty configuration (which does stop 'TemplateEngineSmarty_cache' being generated, fair nuff) but 'TemplateEngineSmarty_compile' still gets created... thus said title variable stays the same on each page.

 

Help a fellow developer stop raging :) Thanks in advance.

Link to comment
Share on other sites

4 hours ago, LimeWub said:

assets/cache

This is not just for the common page cache that is used for speeding the frontend up, so it is not something you want to "ignore". For example FileCompiler "cache" is stored here as well, which is used to make old, none-namespaced code work with ProcessWire 3.x. But, other stuff is also stored here like HannaCode, etc... These are cache files in the sense that they are precompiled or db->to->file stuff, because there is no point in generating them over and over again, since they do not change often.

You can use @Soma's Clear Cache Admin module to easily clear cache files, but normally it is for troubleshooting purposes and not something you should have to do on every occasion you change your code.

Anyway, what sort of Page caching do you use? Out of the box, ProcessWire does not cache templates (except for the FileCompiler cache, but that is re-compiled whenever there are template code changes).

Link to comment
Share on other sites

14 hours ago, szabesz said:

This is not just for the common page cache that is used for speeding the frontend up, so it is not something you want to "ignore". For example FileCompiler "cache" is stored here as well, which is used to make old, none-namespaced code work with ProcessWire 3.x. But, other stuff is also stored here like HannaCode, etc... These are cache files in the sense that they are precompiled or db->to->file stuff, because there is no point in generating them over and over again, since they do not change often.

You can use @Soma's Clear Cache Admin module to easily clear cache files, but normally it is for troubleshooting purposes and not something you should have to do on every occasion you change your code.

Anyway, what sort of Page caching do you use? Out of the box, ProcessWire does not cache templates (except for the FileCompiler cache, but that is re-compiled whenever there are template code changes).

Thanks for the response ^^

Q1 and Q2 are about 2 different issues actually.

Q1: The 'issue' is more of an inconvenience when trying to debug/extend modules when using an IDE. Breakpoints go on one file, edits on other, things can get mixed up since the files have the same name and changes can be lost.

It's more of an annoyance (I can still delete cache manually every time I run) but it's a bit tedious and I'd prefer it if I could just set to compile the module on the fly. Maybe delete the module cache every time it runs and recompile, if I've set it to (I suppose I can just write that tho?)

Q2:

I don't use anything extra for caching. But I'm using TemplateEngineFactory and TemplateEngineSmarty for the templates, and these also compile and store in the cache...

Even so, they are mostly fine and update as they should. My only issue with them is that on this occasion (where I use the 'chunk' feature) my template variables for the chunk don't change when the template including the chunk changes.

Eg.

First time run:

Page: About Us

$title = About

Chunk

$title = About

Second time:

Page: Contact

$title = Contact <--All good!

Chunk

$title = About <--Still 'About' D:

I know it has to do with the fact TemplateEngineSmarty gets compiled first time I run and then is stored in cache; as everything works fine that first time when the compiled and cached version doesn't exist.

I think this 'issue' may have to do with how I use the code, I think I'm bending it to do what I want to be honest. I am not even sure where the compiled versions of the templates get their template variables from, I am pretty sure the variables not changing for the chunk template, are what my problem is.

I am rly confused on this second question...

Link to comment
Share on other sites

I see.

Q1: I do not use Xdebug (or similar if there are any...) so it is not me who can recommend anything in this regard. What I used is @adrian's Tracy Debugger module.

Q2: I neither use TemplateEngineFactory, but you might want to ask a Moderator to move this topic to its own forum and if you do so you should rename this thread as well.

It is not the best idea to ask two unrelated questions in the same thread, even if they are seemingly related, because Q1 should be moved to General Support or Dev Talk, there are other discussion threads about it there: https://www.google.hu/search?as_sitesearch=processwire.com%2Ftalk&as_q=migrate#q=xdebug+site:processwire.com%2Ftalk

Your questions might not be noticed by the right forum members this way.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...