PHP code example of alphavel / cache

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

    

alphavel / cache example snippets


use Cache;

// Set
Cache::set('key', 'value', 3600);

// Get
$value = Cache::get('key');

// Remember pattern
$users = Cache::remember('users', 300, fn() => 
    DB::table('users')->get()
);

// Delete
Cache::delete('key');

// Clear all
Cache::flush();