PHP code example of cvsouth / cache-null

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

    

cvsouth / cache-null example snippets


Cache::forever('test1a', null);
$exists = Cache::has('test1a'); // returns FALSE

$value = Cache::rememberForever('test1b', function() {
    print('calculating');
    return null;
}); // 'calculating' prints every single time

Cache::forever('test2a', null);
$exists = Cache::has('test2a'); // returns TRUE

$value = Cache::rememberForever('test2b', function() {
    print('calculating');
    return null;
}); // 'calculating' prints only the first time