PHP code example of l1n6yun / cache

1. Go to this page and download the library: Download l1n6yun/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/ */

    

l1n6yun / cache example snippets




1n6yun\Cache\Cache;

$cache = new Cache();

$data = [
    'id'   => 1,
    'name' => 'l1n6yun',
    'age'  => 18,
    'sex'  => 'man',
];

$cache->setCache('user_1', $data, 7200);

$user = $cache->getCache('user_1', []);

var_export($user);

array (
  'id' => 1,
  'name' => 'l1n6yun',
  'age' => 18,
  'sex' => 'man',
)

$user->delCache('user_1');

$options = ['cache_path' => __DIR__.'/cache'];

$cache = new Cache($options);

$cache->setCache('key', 'value');