PHP code example of sefirosweb / laravel-general-helper
1. Go to this page and download the library: Download sefirosweb/laravel-general-helper 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/ */
sefirosweb / laravel-general-helper example snippets
// Store data
CacheRequest::set('anyKey', $anyData);
// Retrieve data
$retrieveData = CacheRequest::get('anyKey');
// Hot cache data from function, if key not exists then execute the function to generate them
$retrieveData = CacheRequest::remember('anyKey', function () {
// .. do something
return 'return any data';
});
// Delete cache
CacheRequest::delete('anyKey');
// Store data
RedisHelper::set('anyKey', $anyData, $timeout);
// Retrieve datacall($function, $key = '', $prod = false, $EX = 86400)
$retrieveData = RedisHelper::get('anyKey');
// Hot cache data from function, if key not exists then execute the function to generate them, for default is not executed in production
$retrieveData = RedisHelper::call(function(){
// .. do something
return 'return any data';
}, 'anyKey', $executeInProduction, $timeout);
// Delete cache
RedisHelper::delete('anyKey')