简体   繁体   English

Lithium PHP DocumentSet缓存

[英]Lithium PHP DocumentSet Caching

I'm attempting to cache the results of a query (DocumentSet) in hopes of enhancing performance on my clients application. 我试图缓存查询(DocumentSet)的结果,以期增强客户端应用程序的性能。

So before the find the app will check to see if an appropriate cache key exists and, if so, serve that rather than hitting the DB. 因此,在查找之前,应用程序将检查是否存在适当的缓存键,如果存在,则将其用作缓存而不是访问数据库。

In my had it seems straight forward enough, however upon implementation all I get are time outs. 在我看来,这很简单,但是在实现时,我得到的只是超时。

It appears the app has trouble storing the DocumentSet object into cache? 看来应用程序在将DocumentSet对象存储到缓存中时遇到问题?

It's likely I'm missing something blindingly apparent ... 很可能我错过了令人眼花apparent乱的东西...

Thanks for your help. 谢谢你的帮助。

So, I can't explain why but I'm unable to cache the documentset. 因此,我无法解释原因,但是无法缓存文档集。

Instead I was forced to cache the documentset->to('array'). 相反,我被迫缓存文档集-> to('array')。 Then, while reading from cache create a new DocumentSet object by passing the models schema and the cached array, returning that. 然后,在从缓存中读取数据时,通过传递模型架构和缓存的数组来创建一个新的DocumentSet对象,并返回该对象。

Seems to be working fairly well, if not as elegant as I had hoped. 似乎工作得还算不错,即使没有我希望的那么优雅。

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

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