Jump to content

Manage caching by user group.


MuchDev
 Share

Recommended Posts

I am trying to brainstorm how I should handle this scenario. I use ProCache and currently have it set up to not show cached pages to all users with the wires_challenge cookie. This is working great but I have developed a front end user system which will be making all users possess the cookie. Now I have the need to selectively control what pages are cached and what pages are uncached at a group by group level.  

I thought I might post in procache, but this seems general enough that others may have some insight on how this could be implemented. Should I somehow save the pages that the user is able to view to the cookie and then check this against the page? As it stands now all new users will get uncached pages which is going to seriously slow down the site.

One thing procache will do that may be helpful is that you will always see an uncached view if there is a get variable present. Maybe some way to check the user group and then redirect to the same page with a simple ?var=uncache

Cached behavior:

guests - view all cached

frontend_user - view all cached except pages where they are permitted 

employees - view all uncached

Link to comment
Share on other sites

That is a good point, I can't think of any way that one could do that programmatically. Where I am at right now is pretty much a hack with some code to detect whether the page has a permission that the user has. If the user has the permission then they will see an un-cached page by a redirect to the page with a get variable. This feels like it should work and will of course take some tweaking so that it doesn't inadvertently affect other pages. I am thinking that this is going to get quite complicated. 

Do you happen to have any suggestions for page caching that wouldn't be too terribly hard to implement with apache? Something that would possibly work better for this use case. 

Link to comment
Share on other sites

Where I am at right now is pretty much a hack with some code to detect whether the page has a permission that the user has. If the user has the permission then they will see an un-cached page by a redirect to the page with a get variable. This feels like it should work and will of course take some tweaking so that it doesn't inadvertently affect other pages.

When will this be executed? ProCache skips any php occurrence in the request by directly going from .htaccess to the cached files.

Link to comment
Share on other sites

Well it was my uneducated assumption that I might be able to make it work on the template level. Thank you for the quick response I guess I'll have to abandon that method then.  I suppose that I could generate a cookie that had pages that would be viewed uncached and create a rewrite rule that checks against those values. It looks as if that is standard practice to use client side cookies for specific content (forgive me I don't work with cookies often).

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...