PHP code example of salehhashemi / laravel-configurable-cache

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

    

salehhashemi / laravel-configurable-cache example snippets


use Salehhashemi\ConfigurableCache\ConfigurableCache;
    
// Storing an item in the cache with `_tiny_` prefix for 15 minutes
ConfigurableCache::put('testKey', 'Hello World!', 'tiny');
    
// Retrieving an item from the cache with `_short_` prefix that is stored for an hour
$value = ConfigurableCache::get('testKey', 'short');

// Delete a cache item with `_otp_` prefix
ConfigurableCache::delete('testKey', 'otp');

// if `testKey` doesn't exist in the 'default' cache, the Closure will be executed and its result will be stored in the cache under `testKey` with `_default_` prefix
$value = ConfigurableCache::remember('testKey', function () {
    return 'Hello World!';
});
bash
php artisan vendor:publish --provider="Salehhashemi\ConfigurableCache\ConfigurableCacheServiceProvider"