Hello all,

I'm currently in need of a views cache module which flushes the cache of a specific view as soon as a node of a certain content type was created or updated. I thought this would be a very obvious requirement, but haven't found any way to do this except for writing some custom caching code. My question: Is there any way to do this? If not, would anybody be interesting in using such a module if I would develop one?

Dave

CommentFileSizeAuthor
#3 views_advanced_cache.zip4.62 KBhuesforalice

Comments

dawehner’s picture

I don't think thats such specific stuff should be included into views.

You could sure develop it for your own

a) Write a caching plugin, which adds a specific key to the cache_key
b) use hook_nodeapi to remove the caches with this specific cache_key prefix

merlinofchaos’s picture

Status: Active » Fixed

Such a module would likely be valuable in the contrib space, I think, because it seems to be something that would be commonly wanted. If you are willing to maintain a module, I highly recommend you create the plugin and create a module for it.

huesforalice’s picture

StatusFileSize
new4.62 KB

Thank you for your feedback. What about this? Any objections against writing to the settings table on nodeapi insert/delete? And any other suggestions on what could be included?

dawehner’s picture

I would have used cache_clear_all and use a specific cid to remove from the cache table.

huesforalice’s picture

Is there any special reason for that? I was trying to use the expire function inherited from the original cache plugin object so that my plugin would be as similar as possible to the "reference implementation" that comes with views. Plus I can put in some more settings into my cache plugin and combine multiple cache strategies (as soon as I or someone else thinks of more use cases).

Another question that came to mind: When using the time based caching that comes with views, will one view version be cached for all users, or will it be cached per role or even per user?

Thanks

Dave

dawehner’s picture


new

Is there any special reason for that? I was trying to use the expire function inherited from the original cache plugin object so that my plugin would be as similar as possible to the "reference implementation" that comes with views. Plus I can put in some more settings into my cache plugin and combine multiple cache strategies (as soon as I or someone else thinks of more use cases).

You have less data in your tables :)

steven jones’s picture

Very interesting...subscribe.

steven jones’s picture

Project: Views (for Drupal 7) » Views content cache
Version: 6.x-2.9 » 6.x-1.x-dev
Status: Fixed » Active
steven jones’s picture

Status: Active » Fixed

@huesforalice let me know if you'd like commit access to the module, or feel free to file patches.

This is now working quite nicely, mad!

huesforalice’s picture

Hi Steven,
I was planning to release this as an own small module sometime soon. Or is there any other way of integrating it into views in a sensible manner? If I do release it, then I'd need svn access.
Dave

steven jones’s picture

Ah, I've already released the code as the project that this issue is now attached to.

I note that you don't have CVS access, feel free to post patches and I'll commit them until you get a CVS account.

huesforalice’s picture

Ah ok very nice. I was looking forward to releasing my own first module though. Well never mind, I'll see if I can get svn access and then I'll get back to you.

Bastlynn’s picture

Thank you! Thank you thank you thank you.... this is *exactly* what I was looking for and has done some very nice things for a freelance project I'm working on for a friend. Thank you for tackling this problem. :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.