PHPackages                             thamtech/yii2-refresh-ahead-cache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. thamtech/yii2-refresh-ahead-cache

ActiveYii2-extension

thamtech/yii2-refresh-ahead-cache
=================================

A Refresh-Ahead Cache Strategy for Yii2

v0.3.6(5y ago)032BSD-3-ClausePHPPHP &gt;=5.6.0

Since Jun 10Pushed 5y ago1 watchersCompare

[ Source](https://github.com/thamtech/yii2-refresh-ahead-cache)[ Packagist](https://packagist.org/packages/thamtech/yii2-refresh-ahead-cache)[ RSS](/packages/thamtech-yii2-refresh-ahead-cache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (4)Versions (10)Used By (0)

Yii2 Refresh-Ahead Cache
========================

[](#yii2-refresh-ahead-cache)

Yii2 Refresh-Ahead Cache can decorate Yii2 cache components or other components to implement a refresh-ahead cache strategy.

The Refresh-Ahead cache strategy (also called Read-Ahead) is used to refresh cached data before it expires. By refreshing cached data before it expires (and doing it asynchronously), end-users never have to suffer the delay of the refresh. Furthermore, it can also help avoid a [Cache Stampede](https://en.wikipedia.org/wiki/Cache_stampede).

For license information check the [LICENSE](LICENSE.md)-file.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

```
php composer.phar require --prefer-dist thamtech/yii2-read-ahead-cache

```

or add

```
"thamtech/yii2-read-ahead-cache": "*"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

### Decorate Cache Component

[](#decorate-cache-component)

You can add Refresh-Ahead capability to your application's cache component by attaching the `RefreshAheadCacheBehavior`. For example, in your application configuration:

```
