From 8a70cd09ca92526fa78d75bce8a7843baa8f4a6b Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Thu, 14 Jan 2010 06:20:15 +0000 Subject: #652048 by chx: Factor out the caching pattern from forum. --- modules/forum/forum.module | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'modules') diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 53668052e..26513107a 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -637,21 +637,10 @@ function forum_block_view($delta = '') { break; } - $cache_keys = array_merge(array('forum', $delta), drupal_render_cid_parts()); - // Cache based on the altered query. Enables us to cache with node access enabled. - $query->preExecute(); - $cache_keys[] = md5(serialize(array((string) $query, $query->getArguments()))); - $block['subject'] = $title; - $block['content'] = array( - '#access' => user_access('access content'), - '#pre_render' => array('forum_block_view_pre_render'), - '#cache' => array( - 'keys' => $cache_keys, - 'expire' => CACHE_TEMPORARY, - ), - '#query' => $query, - ); + // Cache based on the altered query. Enables us to cache with node access enabled. + $block['content'] = drupal_render_cache_by_query($query, 'forum_block_view'); + $block['content']['#access'] = user_access('access content'); return $block; } -- cgit v1.2.3