{"id":24659947,"url":"https://github.com/tarantool-php/symfony-lock","last_synced_at":"2025-10-07T21:32:23.736Z","repository":{"id":57065181,"uuid":"274490871","full_name":"tarantool-php/symfony-lock","owner":"tarantool-php","description":"symfony lock adapter for tarantool database","archived":false,"fork":false,"pushed_at":"2024-01-10T18:38:35.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-16T05:15:46.147Z","etag":null,"topics":["adapter","driver","lock","php","symfony","tarantool"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tarantool-php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-23T19:24:18.000Z","updated_at":"2021-12-08T13:24:35.000Z","dependencies_parsed_at":"2022-08-24T04:40:06.502Z","dependency_job_id":null,"html_url":"https://github.com/tarantool-php/symfony-lock","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool-php%2Fsymfony-lock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool-php%2Fsymfony-lock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool-php%2Fsymfony-lock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool-php%2Fsymfony-lock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tarantool-php","download_url":"https://codeload.github.com/tarantool-php/symfony-lock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235658574,"owners_count":19025086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adapter","driver","lock","php","symfony","tarantool"],"created_at":"2025-01-26T03:15:13.150Z","updated_at":"2025-10-07T21:32:18.434Z","avatar_url":"https://github.com/tarantool-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tarantool symfony-lock\n[![License](https://poser.pugx.org/tarantool/symfony-lock/license.png)](https://packagist.org/packages/tarantool/symfony-lock)\n[![Latest Version](https://img.shields.io/github/release/tarantool-php/symfony-lock.svg?style=flat-square)](https://github.com/tarantool-php/symfony-lock/releases)\n[![Total Downloads](https://img.shields.io/packagist/dt/tarantool/symfony-lock.svg?style=flat-square)](https://packagist.org/packages/tarantool/symfony-lock)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/tarantool-php/symfony-lock/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/tarantool-php/symfony-lock/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/tarantool-php/symfony-lock/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/tarantool-php/symfony-lock/?branch=master)\n[![Telegram](https://img.shields.io/badge/Telegram-join%20chat-blue.svg)](https://t.me/tarantool_php)\n\n# About\n\nThe `TarantoolStore` implements symfony `PersistingStoreInterface` using Tarantool Database.\n\n# Installation\n\nThe recommended way to install the library is through [Composer](http://getcomposer.org):\n```\n$ composer require tarantool/symfony-lock\n```\n\n# Prepare Tarantool\n\nTo start working on locking you need to create schema, the package contains schema manager that can be used for that. For additional documentation on client configuration see [tarantool/client repository](https://github.com/tarantool-php/client#creating-a-client).\n\n```php\nuse Tarantool\\Client\\Client;\nuse Tarantool\\SymfonyLock\\SchemaManager;\n\n$client = Client::fromDefaults();\n$schema = new SchemaManager($client);\n\n// create spaces and indexes\n$schema-\u003esetup();\n\n// later if you want to cleanup lock space, use\n$schema-\u003etearDown();\n\n// in addition you can configure TarantoolStore to create schema on demand\n// pay attention, this option is false by default\n$store = new TarantoolStore($client, [\n    'createSchema' =\u003e true,\n]);\n\n```\n\n# Using Store\n\nFor additional examples on lock factory usage follow [symfony/lock docs](https://symfony.com/doc/current/components/lock.html) \n\n```php\nuse Symfony\\Component\\Lock\\LockFactory;\nuse Tarantool\\Client\\Client;\nuse Tarantool\\SymfonyLock\\TarantoolStore;\n\n$client = Client::fromDefaults();\n$store = new TarantoolStore($client);\n$factory = new LockFactory($store);\n\n$lock = $factory-\u003ecreateLock('pdf-invoice-generation');\n\nif ($lock-\u003eacquire()) {\n    // The resource \"pdf-invioce-generation\" is locked.\n    // You can compute and generate invoice safely here.\n    $lock-\u003erelease();\n}\n\n```\n\n# Expiration helper\n\nWhen key is expired it will be removed on acquiring new lock with same name. If your key names are not unique, you can use php cleaner to cleanup your database. The best way to cleanup data is start a fiber inside tarantool. For more details see [expirationd module documentation](https://github.com/tarantool/expirationd)\n\n```php\nuse Tarantool\\Client\\Client;\nuse Tarantool\\SymfonyLock\\Cleaner;\n\n$client = Client::fromDefaults();\n$cleaner = new Cleaner($client);\n\n// cleanup keys that are expired\n$cleaner-\u003eprocess();\n\n// by default cleaner will process upto 100 items\n// you can override it via optional configuration\n$cleaner = new Cleaner($client, [\n    'limit' =\u003e 10,\n]);\n\n```\n\n# Customization\n Out of the box all classes are using space named `lock`. If you want - you can override it via options configuration. All available options and default values are listed below:\n\n```php\nuse Tarantool\\Client\\Client;\nuse Tarantool\\SymfonyLock\\Cleaner;\nuse Tarantool\\SymfonyLock\\SchemaManager;\nuse Tarantool\\SymfonyLock\\TarantoolStore;\n\n$client = Client::fromDefaults();\n$cleaner = new Cleaner($client, [\n    'space' =\u003e 'lock',\n    'limit' =\u003e '100',\n]);\n\n$schema = new SchemaManager($client, [\n    'engine' =\u003e 'memtx',\n    'space' =\u003e 'lock',\n]);\n\n$store = new TarantoolStore($client, [\n    'space' =\u003e 'lock',\n    'initialTtl' =\u003e 300,\n    'createSchema' =\u003e false,\n]);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarantool-php%2Fsymfony-lock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarantool-php%2Fsymfony-lock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarantool-php%2Fsymfony-lock/lists"}