简体   繁体   English

我可以在内部嵌套 APC(替代 PHP 缓存)吗?

[英]Can I nest APC ( Alternative PHP Cache ) inside itself?

Just a quick simple question that I can not seem to find an answer for.只是一个简单的问题,我似乎无法找到答案。

Can I nest APC cache inside another one?我可以将 APC 缓存嵌套在另一个缓存中吗?

For example, say I cache a page and I wanted it updated hourly, but I have a sidebar inside that page that I want updated every 24 hours.例如,假设我缓存了一个页面,我希望它每小时更新一次,但我在该页面中有一个侧边栏,我希望每 24 小时更新一次。

Thanks!谢谢!

edit: I am not asking how to do this, just if it is possible.编辑:我不是在问如何做到这一点,只是如果可能的话。 Examples not required, unless it is a unique technique then how to normally use APC.不需要示例,除非它是一种独特的技术,否则如何正常使用 APC。

Short answer: NO.简短的回答:不。

Long answer: you might be able to do that, but you'd have to break the page into multiple sections, and cache each section independently, and when recomposing the final page to be sent to he user grab each section from its cache...长答案:您也许可以这样做,但是您必须将页面分成多个部分,并独立缓存每个部分,并在重新组合要发送给用户的最终页面时从其缓存中获取每个部分.. .

Yes, it's possible.是的,这是可能的。 Save the segments into separate APC variables via apc_store() and set their TTL (time to live) to 60*60 or 24*60*60, respectively.通过apc_store()将分段保存到单独的 APC 变量中,并将它们的 TTL(生存时间)分别设置为 60*60 或 24*60*60。

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

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