PHP code example of sergeymakinen / yii2-php-file-cache

1. Go to this page and download the library: Download sergeymakinen/yii2-php-file-cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sergeymakinen / yii2-php-file-cache example snippets


[
    'components' => [
        'phpCache' => [
            'class' => 'sergeymakinen\yii\phpfilecache\Cache',
        ],
    ],
]

Yii::$app->phpCache->set('foo', 'bar')

use sergeymakinen\yii\phpfilecache\ValueWithBootstrap;

Yii::$app->phpCache->set(
    'foo',
    new ValueWithBootstrap(
        'bar',
        'Yii::$app->params[\'fromCache\'] = true;'
    )
);

use sergeymakinen\yii\phpfilecache\ValueWithBootstrap;
use yii\helpers\StringHelper;

Yii::$app->phpCache->set(
    'foo',
    new ValueWithBootstrap('bar', function () {
        \Yii::$app->params['fromCache'] = true;
        \Yii::$app->params['name'] = StringHelper::basename('/etc/config');
    })
)
bash
composer 
json
"sergeymakinen/yii2-php-file-cache": "^2.0"