1. Go to this page and download the library: Download marvin255/in-memory-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/ */
marvin255 / in-memory-cache example snippets
use Marvin255\InMemoryCache\InMemoryCache;
$maxCacheSize = 10000; // only 10000 can be stored by this object
$defaultTTL = 60; // 60 seconds as default TTL
$cache = new InMemoryCache($maxCacheSize, $defaultTTL);
use Marvin255\InMemoryCache\InMemoryCache;
use Marvin255\InMemoryCache\CompositeCache;
$maxCacheSize = 10000; // only 10000 can be stored by this object
$defaultTTL = 60; // 60 seconds as default TTL
$inMemoryCache = new InMemoryCache($maxCacheSize, $defaultTTL);
$redisCache = new MyAwesomeRedisCache();
$decorator = new CompositeCache($inMemoryCache, $redisCache);
$decorator->get('test'); // this get will trigger a request to redis and save data to memory
$decorator->get('test'); // this get won't trigger any requests and just return data from memory
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.