Laravel Advance | Install and Use Memcached

sudo apt-get install memcached
sudo apt-get install php-memcached
CACHE_DRIVER=memcached
<?phpuse Illuminate\Support\Str;return [....'stores' => [....'memcached' => ['driver' => 'memcached','persistent_id' => env('MEMCACHED_PERSISTENT_ID'),'sasl' => [env('MEMCACHED_USERNAME'),env('MEMCACHED_PASSWORD'),],'options' => [/* Memcached::OPT_CONNECT_TIMEOUT => 2000, */],'servers' => [['host' => env('MEMCACHED_HOST', '127.0.0.1'),'port' => env('MEMCACHED_PORT', 11211),'weight' => 100,],],],]....]
Route::get('cache-data', function () {$user = \Cache::remember('user', 60, function() {return \App\Models\User::first();});});
php -r '$c = new Memcached(); $c->addServer("localhost", 11211); var_dump( $c->getAllKeys() );'
telnet 127.0.0.1 11211get laravel_cache:user

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store