Having VCC be user and argument aware for caching would be super useful! Invalidation could still work on all entries without any extra validation, but cache entries would be something like viewid,uid,args as a key rather than just viewid.

Is this possible?

Comments

erikwebb’s picture

Status: Active » Postponed (maintainer needs more info)

Looking at Views generally, you could look at the code in Views Per-User Cache to get started. The change is pretty easy, essentially copying and posting the get_output_key() and get_results_key() functions.

For sites with a lot of users, however, this can create a pretty significant amount of cache entries and should probably only be used on sites with a cache backend that imposes a size limit (like Memcached). How many active users are on your site?

obrienmd’s picture

Not many, maybe 20 active users. We have lots of redis space for this too :)

erikwebb’s picture

Status: Postponed (maintainer needs more info) » Postponed

You should be able to easily extend the example in Views Per-User Cache and add to a class inheriting from views_content_cache_plugin_cache. If you can get that going in a sandbox, we can take a better look there.

greg boggs’s picture

Being able to invalidate a cache when a user is updated would be super awesome.

Being able to invalidate a cache when a taxonomy term is updated would also be great. Then you could VCC almost any view.

rooby’s picture

@Greg Boggs:

That is a different feature request to what this issue is about.
You will have a better chance of getting the changes you want if you open a new issue.