PHP code example of previewtechs / simple-cache

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

    

previewtechs / simple-cache example snippets




e = new Memcached();
$cache->addServers([
    ['localhost', 11211, 1]
]);

$cache = new Previewtechs\SimpleCache\Memcached($cache);

// Set Cache key.
$data = [
    'sample' => 'data',
    'another' => 'data'
];

$cache->set('your_custom_key', $data);

// Check cached key exists or not.
$cache->has('your_custom_key');

// Get Cached key data.
$cache->get('your_custom_key');