[英]How to use memcached and apc together in laravel?
我想同时使用memcached和apc进行缓存,如何在laravel中配置和使用它。
By using the Cache
facade you can specify what cache type you want to use. 通过使用“
Cache
外观”,您可以指定要使用的缓存类型。
Cache::store('memcached')->put('bar', 'baz', 10); // Using memcached
Cache::store('apc')->put('bar', 'baz', 10); // Using apc
As you can see in your app/config/cache.php
there is already some preconfigured cache types set up: 如您在
app/config/cache.php
看到的app/config/cache.php
,已经设置了一些预配置的缓存类型:
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache'),
],
'memcached' => [
'driver' => 'memcached',
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
You now need to make sure, memcached and APC are correctly installed on your system. 现在,您需要确保已将memcached和APC正确安装在系统上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.