PHP code example of mabslabs / casper-cache
1. Go to this page and download the library: Download mabslabs/casper-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/ */
mabslabs / casper-cache example snippets
$client = new \Casper\CacheClient();
// Get a value
$value = $client->get('key1');
echo $value; // Output: value1
// Get a value with a callback if it doesn't exist
$newValue = $client->get('key2', function($key) {
return 'generated_value';
});
echo $newValue; // Output: generated_value
// Delete a value
$response = $client->delete('key1');
print_r($response); // Response from server
2. **More exemples in the test file :**
bash
php run.php