{"id":14966428,"url":"https://github.com/yiisoft/mutex-pdo-oracle","last_synced_at":"2025-10-19T09:31:19.725Z","repository":{"id":39587888,"uuid":"181288891","full_name":"yiisoft/mutex-pdo-oracle","owner":"yiisoft","description":"Oracle mutex implementation for yiisoft/mutex.","archived":false,"fork":false,"pushed_at":"2025-01-01T17:07:09.000Z","size":93,"stargazers_count":8,"open_issues_count":3,"forks_count":2,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-09-21T18:45:06.291Z","etag":null,"topics":["hacktoberfest","mutex","oracle","pdo","pdo-oci","yii3"],"latest_commit_sha":null,"homepage":"https://www.yiiframework.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yiisoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"open_collective":"yiisoft","github":["yiisoft"]}},"created_at":"2019-04-14T09:52:25.000Z","updated_at":"2025-01-01T17:07:12.000Z","dependencies_parsed_at":"2024-11-06T05:34:56.752Z","dependency_job_id":"54a7014e-87ef-4753-8787-43b3347312eb","html_url":"https://github.com/yiisoft/mutex-pdo-oracle","commit_stats":{"total_commits":69,"total_committers":10,"mean_commits":6.9,"dds":0.4347826086956522,"last_synced_commit":"44c1ced9ac67f4fbba80bdc61e8a2ec9ab8f8b41"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/yiisoft/mutex-pdo-oracle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fmutex-pdo-oracle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fmutex-pdo-oracle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fmutex-pdo-oracle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fmutex-pdo-oracle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiisoft","download_url":"https://codeload.github.com/yiisoft/mutex-pdo-oracle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fmutex-pdo-oracle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279588563,"owners_count":26196112,"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","status":"online","status_checked_at":"2025-10-18T02:00:06.492Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["hacktoberfest","mutex","oracle","pdo","pdo-oci","yii3"],"created_at":"2024-09-24T13:36:22.306Z","updated_at":"2025-10-19T09:31:19.440Z","avatar_url":"https://github.com/yiisoft.png","language":"PHP","readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/yiisoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://yiisoft.github.io/docs/images/yii_logo.svg\" height=\"100px\" alt=\"Yii\"\u003e\n    \u003c/a\u003e\n    \u003ch1 align=\"center\"\u003eYii Mutex Library - Oracle PDO Driver\u003c/h1\u003e\n    \u003cbr\u003e\n\u003c/p\u003e\n\n[![Latest Stable Version](https://poser.pugx.org/yiisoft/mutex-pdo-oracle/v)](https://packagist.org/packages/yiisoft/mutex-pdo-oracle)\n[![Total Downloads](https://poser.pugx.org/yiisoft/mutex-pdo-oracle/downloads)](https://packagist.org/packages/yiisoft/mutex-pdo-oracle)\n[![Build status](https://github.com/yiisoft/mutex-pdo-oracle/actions/workflows/build.yml/badge.svg)](https://github.com/yiisoft/mutex-pdo-oracle/actions/workflows/build.yml)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/yiisoft/mutex-pdo-oracle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/mutex-pdo-oracle/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/yiisoft/mutex-pdo-oracle/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/mutex-pdo-oracle/?branch=master)\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fmutex-pdo-oracle%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/mutex-pdo-oracle/master)\n[![static analysis](https://github.com/yiisoft/mutex-pdo-oracle/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/mutex-pdo-oracle/actions?query=workflow%3A%22static+analysis%22)\n[![type-coverage](https://shepherd.dev/github/yiisoft/mutex-pdo-oracle/coverage.svg)](https://shepherd.dev/github/yiisoft/mutex-pdo-oracle)\n\nThis library provides an Oracle mutex implementation for [yiisoft/mutex](https://github.com/yiisoft/mutex).\n\n## Requirements\n\n- PHP 7.4 or higher.\n- `PDO` PHP extension.\n\n## Installation\n\nThe package could be installed with [Composer](https://getcomposer.org):\n\n```shell\ncomposer require yiisoft/mutex-pdo-oracle\n```\n\n## General usage\n\nThe package provides two classes implementing `MutexInterface` and `MutexFactoryInterface`\nfrom the [yiisoft/mutex](https://github.com/yiisoft/mutex) package:\n\n```php\nuse Yiisoft\\Mutex\\Oracle\\OracleMutex;\nuse Yiisoft\\Mutex\\Oracle\\OracleMutexFactory;\n\n/**\n * @var \\PDO $connection Configured for Oracle.\n */\n\n$mutex = new OracleMutex(\n    'mutex-name',\n    $connection,\n    OracleMutex::MODE_X, // Optional. Lock mode to be used. Default is `OracleMutex::MODE_X`.\n    false, // Optional. Whether to release lock on commit. Default is `false`.\n);\n\n$mutexFactory = new OracleMutexFactory(\n    $connection,\n    OracleMutex::MODE_X, // Optional. Lock mode to be used. Default is `OracleMutex::MODE_X`.\n    false, // Optional. Whether to release lock on commit. Default is `false`.\n);\n```\n\nRead more about the \"lock mode\" and \"release lock on commit\" options in the\n[Oracle documentation](https://docs.oracle.com/en/database/oracle/oracle-database/21/arpls/DBMS_LOCK.html).\n\nThere are multiple ways you can use the package. You can execute a callback in a synchronized mode i.e. only a\nsingle instance of the callback is executed at the same time:\n\n```php\n$synchronizer = new \\Yiisoft\\Mutex\\Synchronizer($mutexFactory);\n\n$newCount = $synchronizer-\u003eexecute('critical', function () {\n    return $counter-\u003eincrease();\n}, 10);\n```\n\nAnother way is to manually open and close mutex:\n\n```php\n$simpleMutex = \\Yiisoft\\Mutex\\SimpleMutex($mutexFactory);\n\nif (!$simpleMutex-\u003eacquire('critical', 10)) {\n    throw new \\Yiisoft\\Mutex\\Exception\\MutexLockedException('Unable to acquire the \"critical\" mutex.');\n}\n\n$newCount = $counter-\u003eincrease();\n$simpleMutex-\u003erelease('critical');\n```\n\nIt could be done on lower level:\n\n```php\n$mutex = $mutexFactory-\u003ecreateAndAcquire('critical', 10);\n$newCount = $counter-\u003eincrease();\n$mutex-\u003erelease();\n```\n\nAnd if you want even more control, you can acquire mutex manually:\n\n```php\n$mutex = $mutexFactory-\u003ecreate('critical');\n\nif (!$mutex-\u003eacquire(10)) {\n    throw new \\Yiisoft\\Mutex\\Exception\\MutexLockedException('Unable to acquire the \"critical\" mutex.');\n}\n\n$newCount = $counter-\u003eincrease();\n$mutex-\u003erelease();\n```\n\nThe `OracleMutex` supports the \"wait for a lock for a certain time\" functionality. Using the `withRetryDelay()`\nmethod, you can override the number of milliseconds between each try until specified timeout times out:\n\n```php\n$mutex = $mutex-\u003ewithRetryDelay(100);\n```\n\nBy default, it is 50 milliseconds - it means that we may try to acquire lock up to 20 times per second.\n\n## Documentation\n\n- [Internals](docs/internals.md)\n\nIf you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.\nYou may also check out other [Yii Community Resources](https://www.yiiframework.com/community).\n\n## License\n\nThe Yii Mutex Library - Oracle PDO Driver is free software. It is released under the terms of the BSD License.\nPlease see [`LICENSE`](./LICENSE.md) for more information.\n\nMaintained by [Yii Software](https://www.yiiframework.com/).\n\n## Support the project\n\n[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective\u0026logoColor=7eadf1\u0026labelColor=555555)](https://opencollective.com/yiisoft)\n\n## Follow updates\n\n[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)\n[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter\u0026logoColor=1DA1F2\u0026labelColor=555555?style=flat)](https://twitter.com/yiiframework)\n[![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat\u0026logo=telegram)](https://t.me/yii3en)\n[![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat\u0026logo=facebook\u0026logoColor=ffffff)](https://www.facebook.com/groups/yiitalk)\n[![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat\u0026logo=slack)](https://yiiframework.com/go/slack)\n","funding_links":["https://opencollective.com/yiisoft","https://github.com/sponsors/yiisoft"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fmutex-pdo-oracle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiisoft%2Fmutex-pdo-oracle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fmutex-pdo-oracle/lists"}