PHP code example of craftcms / laravel-dependency-aware-cache
1. Go to this page and download the library: Download craftcms/laravel-dependency-aware-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/ */
craftcms / laravel-dependency-aware-cache example snippets
use Illuminate\Support\Facades\Cache;
use CraftCms\DependencyAwareCache\DependencyAwareRepository;
use CraftCms\DependencyAwareCache\Facades\DependencyCache;
/** @var DependencyAwareRepository $cache */
$cache = Cache::store();
/** @var DependencyAwareRepository $cache */
$cache = DependencyCache::store();
use CraftCms\DependencyAwareCache\Dependency\TagDependency;
use Illuminate\Support\Facades\Cache;
Cache::put('item_42_price', 10, null, new TagDependency('item_42'));
Cache::put('item_42_total', 100, null, new TagDependency('item_42'));
Cache::get('item_42_price'); // 10
Cache::get('item_42_total'); // 100
TagDependency::invalidate('item_42');
Cache::get('item_42_price'); // null
Cache::get('item_42_total'); // null