PHP code example of defectivecode / laravel-recall

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

    

defectivecode / laravel-recall example snippets


// Configure recall as your cache driver
// config/cache.php
'stores' => [
    'recall' => [
        'driver' => 'recall',
    ],
],

// Use it like any Laravel cache
use Illuminate\Support\Facades\Cache;

// First call: fetches from Redis, stores locally
$user = Cache::store('recall')->get('user:1');

// Subsequent calls: served from local APCu/Swoole Table (microseconds)
$user = Cache::store('recall')->get('user:1');

// When user:1 is updated anywhere, Redis notifies Recall to invalidate
Cache::store('recall')->put('user:1', $newUserData, 3600);
// Local cache is automatically invalidated on all workers