PHP code example of trevorpe / laravel-symfony-cache
1. Go to this page and download the library: Download trevorpe/laravel-symfony-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/ */
Cache::set('test-key1', 'test-value1'); // Set the item without tags
Cache::get('test-key1'); // Gets the cache item normally
Cache::tags('tag1')->get('test-key1'); // Gets the cache item normally (unaffected by tags)
Cache::tags('tag1')->flush(); // Flushes nothing, as no values are tagged.
Cache::get('test-key1'); // Value is still present
Cache::flush(); // Flushes all cache entries normally
Cache::get('test-key1'); // Value has been removed
// --------------
Cache::tags('tag2')->set('test-key2', 'test-value2'); // Sets the item with a tag
Cache::get('test-key2'); // Gets the cache item normally
Cache::tags('tag2')->get('test-key2'); // Gets the cache item normally (unaffected by tags)
Cache::tags('tag2')->flush(); // Flushes only entries tagged with 'tag2'
Cache::flush(); // Flushes all cache entries normally
Cache::get('test-key2'); // Value will have been removed by either of the above flush() calls
// --------------
Cache::tags('tag3', 'tag4')->set('test-key3', 'test-value3'); // Sets the item with a tag
Cache::get('test-key3'); // Gets the cache item normally
Cache::tags('tag3')->get('test-key3'); // Unaffected. Gets the cache item normally
Cache::tags('tag3')->flush(); // Flushes only entries tagged with 'tag3'
Cache::tags('tag4')->flush(); // Flushes only entries tagged with 'tag4'
Cache::tags('tag3', 'tag4')->flush(); // Flushes only entries tagged with 'tag3' _or_ 'tag4'
Cache::flush(); // Flushes all cache entries normally
Cache::get('test-key3'); // Value will have been removed by any of the above flush() calls
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.