PHP code example of themeplate / cache
1. Go to this page and download the library: Download themeplate/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/ */
themeplate / cache example snippets
use ThemePlate\Cache;
Cache::remember( 'unique_key', function() {
return expensive_task();
}, MINUTE_IN_SECONDS );
Cache::forget( 'unique_key' );
Cache::file( 'special_key', 'path_to_file' );
$processor = Cache::processor();
$processor->report( function( $output ) {
error_log( print_r( $output, true ) );
} );
function hourly_moment() {
return 'to remember ' . time();
}
Cache::remember( 'unique_key', 'hourly_moment', HOUR_IN_SECONDS );