I've configured most of my blocks to be cached, which has greatly reduced the number of queries per page. However, Block Cache Alter is querying the database for every block and checking its cache status.

The attached patch modifies Block Cache Alter to ping the database once per request, storing the block configuration in a static variable, which only takes one database request.

This could be further optimized to store the block cache configuration in the cache table using cache_set() and cache_get(), which, if using Memcache would make it even faster.

CommentFileSizeAuthor
statically-cache-blocks.patch970 bytesjoelstein

Comments

swentel’s picture

Status: Needs review » Fixed

Can live with the patch, although I can imagine this won't have a big impact on most users which probably just change the cache setting of a block and don't call the block themselves in code. Still, like the patch, committed and pushed, thanks!

Status: Fixed » Closed (fixed)

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