开发者

Lightweight method to cache some text with LAMP

I have a symfony website running 开发者_如何学JAVAon the standard LAMP setup.

I need to store about 400 bytes (the result of a JSON query, actually). the result for this query fails often (out of my hands). I want to cache this somehow. what is the easiest, cleanest, lightest way to do this?

I have a MySQL database that's being used by my models, so I could hypothetically use this. but is there a simpler way that I don't know about?


You can use memcached. The biggest thing you need to remember is that it's a cache, and you should be able to cope with it expiring at any time.

There are many tutorials and books available.


Well you could write it to a file!.

$dmp = fopen ("c:\temp\dumpquery" . time() . ".txt", "w');
fwrite ($dmp,$yourquery);
fclose($dmp);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜