Yii2缓存组件之数据库查询缓存

查询缓存

查询缓存是一个建立在数据缓存之上的特殊缓存特性。它用于缓存数据库查询的结果。PS:需配置好缓存配置

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

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

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

如你所见,beginCache()和endCache()中间的任何查询结果都会被缓存起来。如果缓存中找到了同样查询的结果,则查询会被跳过,直接从缓存中提取结果。

查询缓存可以用于ActiveRecordDAO

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

来自GitHub Yii2中文文档

Responses
  1. price for viagra http://viagwdp.com/# pharmacy viagra generic

    Reply
  2. https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ гашиш https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ анаша https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ конопля https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ спайс https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ казино https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ порно доставка бесплатно в любой регион

    Reply
  3. https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ гашиш https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ анаша https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ конопля https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ спайс https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ казино https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ порно доставка бесплатно в любой регион

    Reply
  4. https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ гашиш https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ анаша https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ конопля https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ спайс https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ казино https://compitent.ru/brands/%D0%BC%D0%B8%D1%85%D0%B0%D0%B8%D0%BB-%D1%85%D1%80%D0%B8%D1%81%D1%82%D0%BE%D1%81%D0%B5%D0%BD%D0%BA%D0%BE-%D0%BA%D1%83%D1%80%D1%81%D1%8B/ порно доставка бесплатно в любой регион

    Reply
  5. Bán Nick Gmail cổ 2009>2010 - Tài khoản Gmail Mới Chất lượng cao : https://MuaGmail.com Visit https://MuaGmail.com With thanks Tags: mua email Gmail cổ mua bán nick Gmail bán email Gmail đăng ký Tài khoản Gmail

    Reply
  6. [url=https://sildenafilcitrategeneric.com/]sildenafil online canadian pharmacy[/url]

    Reply