PHP code example of jiaweixs / simplecache

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

    

jiaweixs / simplecache example snippets


//init the tool
SimpleCache::init('.../path/to/cache');
  
//init the tool and set default expire time.
SimpleCache::init('.../path/to/cache',600);

//set cache
$isSuccess = SimpleCache::set('key','hello world');
  
//set cache and set expire time for the 'key'.
$isSuccess = SimpleCache::set('key','hello world',600);

//get cache
$value = SimpleCache::get('key');
  
//get cache and set default value for the 'key'.
$value = SimpleCache::get('key','default value');