PHP code example of slydeath / laravel-nested-caching

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

    

slydeath / laravel-nested-caching example snippets


SlyDeath\NestedCaching\NestedCachingServiceProvider::class,

use SlyDeath\NestedCaching\NestedCacheable;

class User extends Model
{
    use NestedCacheable;
}

use SlyDeath\NestedCaching\NestedCacheable;

class CarUser extends Model
{
    use NestedCacheable;

    // Specifying the parent relations
    protected $touches = ['user']; 

    // Parent relation
    public function user()
    {
        return $this->belongsTo(User::class);
    }
}

app(SlyDeath\NestedCaching\CacheStack::class)->clearCache();

app(\SlyDeath\NestedCaching\CacheStack::class)->getAnotherCaches();

 app(\SlyDeath\NestedCaching\CacheStack::class)->clearAnotherCaches();

app(\SlyDeath\NestedCaching\CacheStack::class)->setAnotherKey('my-cache-key-prefix:' . optional($page)->id)->getAnotherCaches();

 app(\SlyDeath\NestedCaching\CacheStack::class)->setAnotherKey('my-cache-key-prefix:' . optional($page)->id)->clearAnotherCaches();
bash
php artisan vendor:publish --provider="SlyDeath\NestedCaching\NestedCachingServiceProvider" --tag=config
 if ( ! app('SlyDeath\NestedCaching\BladeDirectives')->cache(