初始化
This commit is contained in:
30
config/plugin/yzh52521/lock/app.php
Normal file
30
config/plugin/yzh52521/lock/app.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Lock\Store\FlockStore;
|
||||
use Symfony\Component\Lock\Store\RedisStore;
|
||||
|
||||
return [
|
||||
'enable' => true,
|
||||
'storage' => 'redis', // file/redis, 建议使用 redis,file 不支持 ttl
|
||||
'storage_configs' => [
|
||||
'file' => [
|
||||
'class' => FlockStore::class,
|
||||
'construct' => [
|
||||
'lockPath' => runtime_path() . '/lock',
|
||||
],
|
||||
],
|
||||
'redis' => [
|
||||
'class' => RedisStore::class,
|
||||
'construct' => function () {
|
||||
return [
|
||||
'redis' => \support\Redis::connection('default')->client(),
|
||||
];
|
||||
},
|
||||
],
|
||||
],
|
||||
'default_config' => [
|
||||
'ttl' => 300, // 默认锁超时时间
|
||||
'auto_release' => true, // 是否自动释放,建议设置为 true
|
||||
'prefix' => 'lock_', // 锁前缀
|
||||
],
|
||||
];
|
||||
Reference in New Issue
Block a user