douyingtai6662 2014-04-09 21:39
浏览 83

不要缓存一些HTML

I would like to know if I can exclude some of the HTML from being cached. I am using MediaWiki software. So any MediaWiki solution or any other PHP solution will work as well.

My Mediawiki pages are cached and I am implementing the site notice feature which expires after few days. But when pages are cached, it doesn't honor my expiration date and being displayed all the time. so I want to exclude that part of the code from being cached. I am implementing it as a MediaWiki extension.

Thanks

  • 写回答

1条回答 默认 最新

  • dongyong3554 2014-04-10 06:25
    关注

    MediaWiki caching works in many layers. There are a number of server side caches, apart from the caching in the client. (As you might have noticed, MW i notoriously slow, unless you implement at least some of the caching functionalities.)

    First of all you will want to figure out which sitenotices are cached. As I'm sure you are aware, there is more than one place where you can set the sitenotice:

    • MediaWiki:Anonnotice
    • MediaWiki:Sitenotice
    • $wgSiteNotice in LocalSettings.php
    • Through a few different extensions

    Do they all stay on the page for too long?
    Secondly, you can try and figure out where your sitenotice is cached:

    • Is there any difference if you are logged in/out? Some parts of the interface can be harder cached for anonymous users.
    • Does the message disappear if you clear you browsers cache?
    • Try and disable Varnish (or Squid), if you are using any of them.
    • Temporarily disable $wgEnableParserCache to see what difference it makes.
    • Set $wgCachePages = false; in your LocalSettings.php, to try and disallow client side caching
    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题