thamtech/yii2-multilevel-cache

A multi-level cache component for Yii2

Fund package maintenance!
Liberapay

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

v0.1.0 2020-06-05 05:17 UTC

This package is auto-updated.

Last update: 2024-04-10 03:18:39 UTC


README

Multilevel cache is a Yii2 cache component to support multi-level caching.

Configure a fast, local cache component like ArrayCache as the level1 cache, and configure a slower cache component like FileCache as the level2 cache. The multilevel cache component will automatically check the level1 cache first and only check level2 and populate level1 with the result when level1 misses.

Installation

The preferred way to install this extension is through composer.

php composer.phar require --prefer-dist thamtech/yii2-multilevel-cache

or add

"thamtech/yii2-multilevel-cache": "*"

to the require section of your composer.json file.

Usage

Application configuration example:

<?php
'components' => [
    'cache' => [
        'class' => 'thamtech\caching\multilevel\BiLevelCache',
        'level1' => [
            'class' => 'yii\caching\ArrayCache',
            'serializer' => false,
        ],
        'level2' => [
            'class' => 'yii\caching\FileCache',
        ],
    ],
],

See Also