1. Go to this page and download the library: Download alksily/memory 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/ */
alksily / memory example snippets
Alksily\Memory\Mem::initialize([
[
'host' => 'localhost',
'port' => '11211',
'timeout' => 10,
// additional can be passed options, server-role and pool name:
// 'driver' => 'memcache', // or redis
]
]);
Alksily\Memory\Mem::set('foo', 'bar');
Alksily\Memory\Mem::get('foo', /* 'default value' */);
// -- or --
Alksily\Memory\Mem::get('foo', function () {
// some action, e.g. just return string
return 'baz';
});