aboutcoders/resource-lock-bundle

简单资源锁定

0.2.0 2021-02-18 19:36 UTC

This package is not auto-updated.

Last update: 2024-09-14 05:57:05 UTC


README

一个提供资源锁定实现的 Symfony 扩展包

Build Status

安装

将 AbcResourceLockBundle 添加到您的 composer.json 文件中

{
    "require": {
        "aboutcoders/resource-lock-bundle": "dev-master"
    }
}

在 AppKernel.php 类中包含该扩展包

public function registerBundles()
{
    $bundles = array(
        // ...
        new Abc\Bundle\ResourceLockBundle\AbcResourceLockBundle(),
    );

    return $bundles;
}

配置

配置扩展包

# app/config/config.yml
abc_resource_lock:
  db_driver: orm

您可以在 managers 部分中定义具有自定义前缀的自定义管理器

# app/config/config.yml
abc_resource_lock:
  db_driver: orm
  managers:
    my_manager:
        prefix: my_prefix
    another_manager:
        prefix: another_prefix

使用方法

使用锁管理器来获取、设置或检查锁

$container->get('abc.resource_lock.lock_manager');

要从服务容器中获取自定义管理器,您必须通过其名称指定它

$container->get('abc.resource_lock.lock_manager_my_manager');

许可证

MIT 许可证 (MIT)。请参阅 许可证文件 以获取更多信息。