PHP code example of mouf / utils.cache.cache-interface
1. Go to this page and download the library: Download mouf/utils.cache.cache-interface 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/ */
mouf / utils.cache.cache-interface example snippets
interface CacheInterface {
/**
* Returns the cached value for the key passed in parameter.
*
* @param string $key
* @return mixed
*/
function get($key);
/**
* Sets the value in the cache.
*
* @param string $key The key of the value to store
* @param mixed $value The value to store
* @param int $timeToLive The time to live of the cache, in seconds.
*/
function set($key, $value, $timeToLive = null);
/**
* Removes the object whose key is $key from the cache.
*
* @param string $key The key of the object
*/
function purge($key);
/**
* Removes all the objects from the cache.
*
*/
function purgeAll();
}
$cache->set("mykey", "myvalue", 15);
// Will print "myvalue" if called within 15 seconds.
echo $cache->get("mykey");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.