I have only the "authenticated" role selected in authache config. Authcache seems to be caching pages, according to the debug output. When I load/cache a page using a user with only the role "authenticated user" the cache works, but if I then try visiting the same page in a different browser when i'm logged in as admin uid:1, I am served the unauthenticated page cached.

Comments

simg’s picture

Status: Active » Closed (works as designed)

This is working as designed.

How authcache works is to cache pages on a per role(s) basis. (or rather based on the combination of roles a user has)

So for example "user1" visits a page with roles "A" and "B". No suitable page exists in the cache, so a page is generated and then stored in the cache with a cache prefix of "AB".

user2 visits the same page and has roles of "A", "B" and "C". The previously cached page is not valid for them since the "C" role is likely to change their view of the page, so a new page is generated and stored in the cache with a cache prefix of "ABC".

user3 visits the same page with a role of "A". Still no cached pages are valid so a new page is generated and cached with a cache prefix of "A".

user4 visits with roles of "A" and "B". Eureka, a cached page exists with the cache prefix "AB" so user4 gets a fast page.

It follows, that the more roles you have on your site (and/or) the more roles assigned to each user, the less likely you are to get cache hits.

Hope this makes sense? Marking as "closed - works as designed" but you're welcome to re-open and ask questions.

Canadaka’s picture

Status: Closed (works as designed) » Needs review

I understand how authcache works with roles, that's not what my problem is.

User 1 with role "A" visits a page and creates a cache.
User 2 with roles "AB" visits this same page gets the cached page from User1 "A".

In my case User 2 is the administrator uid:1. I can quickly tell when this happens because the cached page doesn't have the black admin bar. My uid:1 has 2 roles selected, "administrator" & "authenticated user". User 1 only has "authenticated user" role selected.
in the authcache setup "Enable caching for specified user roles" I have only these 2 roles selected.

simg’s picture

up until last week, Authcache was coded to be specifically disabled for uid:1.

that struck me as strange and sub-optimal, and since it was easy to remove the single line of code that prevented it from working for uid:1, I did so. I wonder if there might be code / issues elsewhere that prevent it from working for uid:1. Based on this post http://drupal.org/node/970810, it maybe that I re-disable uid:1 caching anyway.

Do you still have this problem if User 2 is not uid:1 ?

Canadaka’s picture

So I created a new test user and added roles A & C. I then tested against my other test account with only role A. I couldn't reproduce the problem so it does seem to be an issue with uid:1.

simg’s picture

Status: Needs review » Closed (works as designed)

ah, I think what's going on here is that Authcache handles the "authenticated user" role slightly oddly.

If you enable authcache for the "authenticated user" role, this only applies to users that *only* have this role.

So, your admin user presumably has the "administrator" role, therefore authcache doesn't cache for that user?

FWIW, I did a lot of work on authcache last night. Lots of bugs fixed and the latest dev version now has *much* better and more consistent debugging info which should help.

Setting to "closed: works as designed" again, but as before, if you feel I haven't understood / answered the question, you're welcome to re-open.

edit: btw, you should find that Authcache currently *works* for uid:1 - it does for me :)

simg’s picture

Status: Closed (works as designed) » Needs work

ok, I've noticed the same problem. will investigate ...

simg’s picture

Status: Needs work » Closed (fixed)

I think this should now be fixed. The problem I found was that Authcache_user_logout was not firing and therefore not deleting the authcache cookie. Therefore your "other browser" probably had an authcache key for the last authenticated user.