查询缓存需要一个 [[yii\db\Connection|数据库连接]] 和一个有效的cache应用组件。查询缓存的基本用法如下,假设$db是一个 [[yii\db\Connection]] 实例:

$duration = 60; // 缓存查询结果60秒 
$dependency = ...; // 可选的缓存依赖

$db->beginCache($duration, $dependency); 
// ...这儿执行数据库查询...



Info: 有些 DBMS (例如:MySQL)也支持数据库服务器端的查询缓存。你可以选择使用任一查询缓存机制。上文所述的查询缓存的好处在于你可以指定更灵活的缓存依赖因此可能更加高效。

来自GitHub Yii2中文文档

  1. Great items from you, man. I've take note your stuff prior to and you're simply extremely great. I actually like what you've bought here, certainly like what you're stating and the way during which you say it. You're making it entertaining and you still take care of to stay it smart. I can not wait to learn much more from you. This is actually a wonderful site.

  2. This is the proper blog for anybody who desires to seek out out about this topic. You understand a lot its nearly arduous to argue with you (not that I actually would need匟aHa). You positively put a new spin on a subject thats been written about for years. Nice stuff, just nice!

  3. [url=https://cialislh.com/]daily generic cialis[/url]

  4. New super hot photo galleries, daily updated collections http://sallis.xnxxporn2go.amandahot.com/?destiney teen porn videos en formato french porn teen ass fucking hard core porn free miss molly 8 porn film sexpo asutralia picture porn

  5. Pretty nice post. I just stumbled upon your blog and wished to say that I have really enjoyed surfing around your blog posts. In any case I will be subscribing to your feed and I hope you write again soon!

  6. If you want to take a great deal from this piece of writing then you have to apply such methods to your won weblog.