hahn-admin/config/plugin/webman-tech/symfony-lock/lock.php

30 lines
852 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
use Symfony\Component\Lock\Store\FlockStore;
use Symfony\Component\Lock\Store\RedisStore;
return [
'storage' => 'redis', // file/redis 建议使用 redisfile 不支持 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_', // 锁前缀
],
];