在每个页面上缓存一个具有会话特定数据的Drupal站点 [英] Caching a Drupal site with session-specific data on every page

查看:97
本文介绍了在每个页面上缓存一个具有会话特定数据的Drupal站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个用Drupal 6编写的网站。



我们想使用Drupal的缓存机制来提高性能,但是当我们打开它们时,我们发现了问题,因为我们站点在每个页面上都显示会话数据。 Drupal的缓存系统仅适用于静态内容页面,我们的会话数据有效地意味着我们的页面都不是静态的。



我们已经提出了两个解决方案:


  1. 重写显示会话数据的块,以便使用Ajax加载非静态数据,以便主HTML内容是静态的。这样做的缺点在于它意味着相当多的工作,并且它将减少非启用Javascript的用户和特殊浏览器(即屏幕阅读器)的功能。


  2. 将会话数据移动到 iframe 或类似文件。这只是听起来错误,我不想这样做,但它会解决问题,我想。


  3. 或找到一个替代的缓存系统,允许我们以每个页面上处理一小块动态数据的方式来缓存站点。这是我们首选的选择,但是我们无法在找到任何内容方面取得任何进展。因此,这里是一个问题。


所以如果有任何建议可以帮助我们选择3,请让我们知道。谢谢。



(ps - 我知道Drupal 7有一个改进的缓存系统,可以帮助这个,但我们还没有准备好移动到D7) / p>


在这方面没有取得太多进展,所以我会把它打开一个赏金。



我已经看看了Ubercart如何处理类似的情况(因为它是最受欢迎的Drupal模块之一,并且与我们一样解决了基本相同的问题)。当用户未登录时,通过让购物车信息块显示静态文本(即点击此处查看您的购物篮),并且仅在用户登录时在每个页面上显示动态购物车数据,才可以绕过它。不觉得这实际上解决了问题;它只是逃避它,这不是我们想要的。但是我担心,如果Ubercart以这种方式采取行动,那可能是唯一的选择。

解决方案

Ajax块。



比Authcache更简单的解决方案是Ajax块。



http://drupal.org/project/ajaxblocks



运行良好,从我记得它处理没有js的用户相当好。


We have a site written in Drupal 6.

We want to use Drupal's caching mechanism to improve performance, but when we turned it on, we found problems because our site has session data displayed on every page. Drupal's caching system only works for static content page, and our session data effectively means that none of our pages are static.

We've come up with two solutions to this:

  1. Rewrite the block that shows the session data such that it loads the non-static data using Ajax, so that the main HTML content is then static. The down-sides of this are that it will mean quite a lot of work, and also that it will reduce functionality for non-Javascript-enabled users and speciality browsers (ie screen-readers).

  2. Move the session data to an iframe or similar. This just sounds wrong and I don't want to do it, but it would fix the problem, I think.

  3. or find an alternative caching system that will allow us to cache the site in a way that can deal with a there being a small block of dynamic data on every page. This is our preferred option, but we haven't been able to make any progress on finding anything, hence the question here.

So if anyone has any suggestions that would help us with option 3, please let us know. Thank you.

(ps - I know Drupal 7 does have an improved caching system which could help with this, but we're not ready to move to D7 yet)

[EDIT] Haven't made much progress on this, so I'll open it up to a bounty.

I've had a look into how Ubercart deals with a similar situation (since it's one of the most popular Drupal modules and has basically the same problem to solve as we do). They get around it by having the cart info block display static text when the user is not logged in (ie "Click here to view your basket"), and only showing the dynamic cart data on every page when the user is logged in. We don't feel this actually solves the problem; it just evades it, and that's not what we want. But I'm worried that if Ubercart has resorted to doing it this way, it may turn out to be the only option.

解决方案

Ajax Blocks.

A simpler Solution than Authcache is Ajax Blocks.

http://drupal.org/project/ajaxblocks

Works well, and from what I remember it handles users without js fairly well.

这篇关于在每个页面上缓存一个具有会话特定数据的Drupal站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆