1. Go to this page and download the library: Download clowdy/multi-memcached 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/ */
Cache::connection('data1')->get('somekey');
// or you can omit the connection method to use the default connection.
Cache::get('somekey');
// also perform a multi get using an array
Cache::get(['key1', 'key2']);
namespace Some\App;
use Illuminate\Cache\Repository as CacheRepository;
class SomeClass
{
protected $cache;
public function __construct(CacheRepository $cache)
{
$this->cache = $cache;
}
public function update($data)
{
$this->cache->put('key', $data, 60);
$this->update2($data);
}
public function update2($data)
{
$this->cache->connection('data2')->put('key', $data, 60);
$this->update3(['key' => $data]);
}
public function update3(array $data)
{
$this->cache->connection('data3')->put(array_keys($data), array_values($data), 60);
// or
$this->cache->connection('data3')->putMulti($data, 60);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.