开发者

Drupal 6 Views 2: Programmatically Rebuild View Cache

开发者 https://www.devze.com 2023-03-16 05:11 出处:网络
开发者_StackOverflowI\'m attempting to write a PHP snippet that will rebuild the cached output for all pages and displays in a specific view. I have a separate process currently clearing out the cache

开发者_StackOverflowI'm attempting to write a PHP snippet that will rebuild the cached output for all pages and displays in a specific view. I have a separate process currently clearing out the caches, but then each paged output of my view has to be physically viewed in order to have the contents stored in the cache tables.

Can someone point me in the right direction? I've found the following contrib functions, but they don't seem to be what I'm looking for:

  • views_cache_set()
  • views_cache_get()

Any help would be greatly appreciated. Thanks!


If you are only dealing with cache inside of a standard view and want your displayed information to be not only current but pre cached before the first hit (and right after a flush), you can use what my partner and I are doing for our project.

We are using Views Content Cache which is very helpful for flushing the caches set inside of views to keep the information as current as possible.

Our solution is to use views_get_view_result() to invoke the view. We use

views_get_view_result('employee_master');
drupal_goto('');

You can put this code in a snippet or a function in your custom module (not sure about the .tpl files) and make rules or code to execute it.

0

精彩评论

暂无评论...
验证码 换一张
取 消