PHP code example of renpengpeng / php-cache

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

    

renpengpeng / php-cache example snippets



enpengpeng\Cache;

Cache::connect([
	'type'	=>	'File',
	'file'	=>	[
		'cache_dir'	=>	realpath(__DIR__).DIRECTORY_SEPARATOR.'cache'
	]
],true);

// Set the cache 60 seconds
Cache::set('version','1.0.0',60);

// Get the cache
Cache::get('version','1.0.0');

// Since the increase
Cache::increment('version');

// Since the reduction of
Cache::reduction('version');

// Delay is permanent
Cache::delay('version');

// Delete the cache
Cache::delete('version');

// Clear the cache
Cache::clear();