PHP code example of binarybuilds / filament-cache-manager

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

    

binarybuilds / filament-cache-manager example snippets


use BinaryBuilds\FilamentCacheManager\FilamentCacheManagerPlugin;

$panel->plugin(FilamentCacheManagerPlugin::make());

FilamentCacheManagerPlugin::make()
    ->canAccessPlugin(fn () => Auth::user()->role === 'Admin');

FilamentCacheManagerPlugin::make()
    ->canForgetKey(fn () => Auth::user()->role === 'Admin');

FilamentCacheManagerPlugin::make()
    ->canFlushCache(fn () => false);

FilamentCacheManagerPlugin::make()
    ->navigationLabel('Cache');

use Filament\Support\Icons\Heroiconl;

FilamentCacheManagerPlugin::make()
    ->navigationIcon(Heroicon::CpuChip);

FilamentCacheManagerPlugin::make()
    ->navigationGroup('Settings');

FilamentCacheManagerPlugin::make()
    ->addCacheKey(
        'homepage',
        'Homepage Cache',
        'Clear this cache if the content on the homepage is out of date.'
    )
    ->addCacheKey(
        'layout',
        'Layout Cache',
        'Clear this cache if you recently made changes to menu items. Beware! this might cause a temporary slowness to the application.',
        'danger'
    )
    ->addCacheKey(
        'settings',
        'Settings Cache',
        'Clear this cache if you recently updated site settings'
    )
    ->addCacheKey(
        'articles',
        'Articles Cache',
        'Clear this cache if you added or updated articles and your changes are not reflecting on the site.'
    );

FilamentCacheManagerPlugin::make()
    ->columns(3);