yii2框架中是否可以使用两个或多个缓存存储?我已经为我的网络应用程序设置了Memcache,但我也想使用FileCache,因为我将处理大量数据。
希望有人能帮忙。谢谢
您可以设置任何缓存。只需在配置文件中设置即可。
'components' => [
'cache' => [
'class' => 'yii'caching'FileCache',
],
'memCache' => [
'class' => 'MEMCACHE CLASS HERE',
],
.... ANY cache you want ...
]
您可以注册多个缓存应用程序组件。默认情况下,许多依赖缓存的类(例如yii''web''UrlManager)使用名为缓存的组件。
官方链接
'components' => [
'cache' => [
'class' => 'yii'caching'MemCache',
],
'fileCache' => [
'class' => 'yii'caching'FileCache',
]
]