简体   繁体   English

Drupal 6视图2:以编程方式重建View Cache

[英]Drupal 6 Views 2: Programmatically Rebuild View Cache

I'm attempting to write a PHP snippet that will rebuild the cached output for all pages and displays in a specific view. 我正在尝试编写一个PHP代码段,它将重建所有页面的缓存输出并在特定视图中显示。 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: 我发现了以下的contrib函数,但它们似乎并不是我想要的:

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. 我们正在使用Views Content Cache ,它非常有助于刷新视图中设置的缓存,以使信息尽可能保持最新。

Our solution is to use views_get_view_result() to invoke the view. 我们的解决方案是使用views_get_view_result()来调用视图。 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. 您可以将此代码放在自定义模块的片段或函数中(不确定.tpl文件)并制定规则或代码来执行它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM