Jump to content

Caught out by caching (I think)


alan
 Share

Recommended Posts

I was trying to find pages that one or more items populated in an AsmSelect field with:

$tagged_pages = $pages->find("tags.count>0");

My test kept finding the Home page that didn't have anything populated in the AsmSelect field "tags".

Eventually after trying lots of alternate ways to do this search, as I'd been adding and removing fields etc, even though Home showed no items in it's AsmSelect, I added one, then deleted it, back to no items, and now the test that had appeared broken was working fine.

Might this be due to caching and if so is there a way, while developing, I can globally set PW to not cache so stuff like this can't happen? Or might it be due to me adding/removing/adding back fields and somehow confusing some internal/session/other-cached settings?

Tks to anyone with any ideas! :)

Link to comment
Share on other sites

I would say that this actually sounds like a bug - before you had any tags produced a different result to when you added and deleted one and tested it again and that's not right...

Link to comment
Share on other sites

This really sounds like bug – after we can confirm, that you haven't made any other changes, that could possibly affect this.

After all, AFAIK, caching doesn't really matter if you're logged in AND superuser – any cache is ignored for 'admin' (or 'root' or... you get my point).

Link to comment
Share on other sites

I experienced some strange behavior when editing templates. Once you do a refresh when editing it can screw up the fields added to it completely. Last time I had to delete the template completely, because it got fields added like "role" which can't be deleted once added! Really strange, it might not related to this issue here but thought I could mention it here.

Link to comment
Share on other sites

I don't think this sounds like a caching issue. Adam is right, if you are logged in and have edit access, you aren't getting anything cached unless you've cached it yourself manually (using the MarkupCache module).

Alan is it possible that any of the pages in question were unpublished or hidden and not participating in the count? If not, I'm honestly not sure what could have caused the tags.count to not work properly in this example here. That particular selector translates to a MySQL count() query, so its a surprising one to fail. If anyone finds that it can be repeated, please let me know and we can fix it.

I experienced some strange behavior when editing templates. Once you do a refresh when editing it can screw up the fields added to it completely. Last time I had to delete the template completely, because it got fields added like "role" which can't be deleted once added! Really strange, it might not related to this issue here but thought I could mention it here.

Ouch, this doesn't sound fun. I won't ask you to try and reproduce that one. :) I'll try from here. Some browsers (Firefox especially) do strange things to forms when you hit reload. Not sure if it's still the case, but Firefox used to advance radio buttons to the next item every time you hit reload in a form. I think some of this can be resolved by setting an autocomplete attribute to off on the <form> tag (and we may need to do that on the form in question).

Link to comment
Share on other sites

Thanks all for your comments.

@Ryan I've not touched on caching yet as I learn my way into PW and both the Cache and MarkupCache modules are currently uninstalled.

Alan is it possible that any of the pages in question were unpublished or hidden and not participating in the count?

I am doing a site-wide find but the only pages I was working on were, I think, both Published and visible; but some pages are hidden, /_Site_settings/ and /_Tools/ etc).

This has not happened again. Re the Firefox ref in case relevant I now develop in Chrome.

This was a time when I didn't distinguish what was happening as something I should try to record so I'm afraid I don't have backups of before this happened to allow me to try to reproduce. Of course if anything more comes to mind/happens, I'll post again.

  • Like 1
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

×
×
  • Create New...