1. Go to this page and download the library: Download koded/cache-simple 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/ */
koded / cache-simple example snippets
// with Redis extension
simple_cache_factory('redis');
// with Predis library
simple_cache_factory('predis');
/*
* Creates a simple cache instance
* with MemcachedClient and default configuration
*/
$cache = simple_cache_factory('memcached');
/*
* Some configuration directives for the cache client
* are passed in the second argument as array
*/
$cache = simple_cache_factory('redis', [
'host' => '127.0.0.1',
'serializer' => 'json',
'prefix' => 'test:',
'ttl' => 3600 // 1 hour global TTL
]);
$config = new ConfigFactory(['serializer' => 'json', 'prefix' => 'test:', 'ttl' => 3000]);
$cache = (new ClientFactory($config))->new('redis');
// Without defining the parameters the above directives are used as default
$cache = simple_cache_factory('redis');