mehr-it / lara-local-synchronized-cache
高性能本地缓存,可在分布式系统上自动同步
2.1.2
2022-12-20 10:49 UTC
Requires
- php: >=7.3
- laravel/framework: ^6.0|^7.0|^8.0
- mehr-it/php-cache: ^1.0
Requires (Dev)
- orchestra/testbench: ^4.0|^5.0|^6.0
- phpunit/phpunit: ^7.4|^8.4
README
高性能本地缓存,可在分布式系统上自动同步。
简介
使用PHP文件进行数据缓存是PHP中速度最快的一种缓存方法。特别是opcache使得这种方法非常快。然而,没有同步机制,这种缓存方法不能用于分布式系统。
此包实现了一个快速且同步的本地缓存。本地缓存的数据会定期同步,每次处理队列中的作业时也会同步。
本地缓存状态使用常见的缓存后端,如redis或您喜欢的任何网络缓存进行同步。
安装
通过composer安装
composer require mehr-it/lara-local-synchronized-cache
配置
'local-sync' => [
'driver' => 'local-synchronized',
// path for cache data
'path' => storage_path('framework/cache/local-sync'),
// name of the cache used for synchronizing the global state
'shared_store' => null,
// time to live for locally cached data (in seconds) before the global state is synchronized again
'local_ttl' => 60,
// prefix for keys in shared store
'shared_store_pfx' => 'loc-sync-cache_',
// set file permission
'file_permission' => 0644,
// set directory permission
'directory_permission' => 0755,
],