As per discussion in http://drupal.org/node/111975,
attached is a patch that moves cached queries out of {view_view} and into {cache}

I tested it to work OK with cacheable views, uncacheable views (because of arguments), and cacheable or uncacheable views with run-time substitutions (filter "author is currently logged in user")

Additional tests are welcome, of course.

BTW, I created a _views_get_query function in views_cache.inc, maybe that is not the right place ? (besides, views_cache.inc does not exist in 4.7 branch, I believe)

Comments

yched’s picture

Status: Active » Needs review
StatusFileSize
new8.01 KB

forgot to drop the cache when the view is saved or deleted
+ forgot 'review' status

yched’s picture

StatusFileSize
new8.03 KB

Previous patch caused SQL errors because of missing $table argument in cache_clear_all calls

+ bump ?

moshe weitzman’s picture

seems a bit odd to move code from a specialized table in the general cache table. wouldn't we at least want a dedicated cache table like cache_menu, cache_page, etc. specializing these tables is nice because deletes become much cheaper.

yched’s picture

Yes, there is another thread about that : http://drupal.org/node/115849, and we discussed there if both patches should be merged. It was decided to do that separately.
Whichever one goes in first, the other patch should be pretty easy to update.

merlinofchaos’s picture

Status: Needs review » Fixed

Applied with some changes.

First, the cid uses the view name rather than the vid for finding a query in the cache. This means that default queries can have their query cached, which is an improvement.

I also successfully backported this to 4.7.

Anonymous’s picture

Status: Fixed » Closed (fixed)