{"id":16897711,"url":"https://github.com/endroid/flusher","last_synced_at":"2025-04-11T13:51:58.158Z","repository":{"id":56977721,"uuid":"98227065","full_name":"endroid/flusher","owner":"endroid","description":"Auto optimizing entity manager flusher","archived":false,"fork":false,"pushed_at":"2024-10-20T14:06:43.000Z","size":47,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T10:05:18.292Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://endroid.nl/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/endroid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"endroid"}},"created_at":"2017-07-24T19:27:31.000Z","updated_at":"2024-10-20T14:06:15.000Z","dependencies_parsed_at":"2025-02-19T13:38:10.319Z","dependency_job_id":"cc737ef5-1020-4e1f-96dd-e2bb08045631","html_url":"https://github.com/endroid/flusher","commit_stats":{"total_commits":66,"total_committers":2,"mean_commits":33.0,"dds":"0.045454545454545414","last_synced_commit":"b9255f59de81ecb91852c0117974022b33725f90"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endroid%2Fflusher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endroid%2Fflusher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endroid%2Fflusher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endroid%2Fflusher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/endroid","download_url":"https://codeload.github.com/endroid/flusher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248411971,"owners_count":21099036,"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":[],"created_at":"2024-10-13T17:39:25.094Z","updated_at":"2025-04-11T13:51:58.122Z","avatar_url":"https://github.com/endroid.png","language":"PHP","funding_links":["https://github.com/sponsors/endroid"],"categories":[],"sub_categories":[],"readme":"# Flusher\r\n\r\n*By [endroid](https://endroid.nl/)*\r\n\r\n[![Latest Stable Version](http://img.shields.io/packagist/v/endroid/flusher.svg)](https://packagist.org/packages/endroid/flusher)\r\n[![Build Status](https://github.com/endroid/flusher/workflows/CI/badge.svg)](https://github.com/endroid/flusher/actions)\r\n[![Total Downloads](http://img.shields.io/packagist/dt/endroid/flusher.svg)](https://packagist.org/packages/endroid/flusher)\r\n[![Monthly Downloads](http://img.shields.io/packagist/dm/endroid/flusher.svg)](https://packagist.org/packages/endroid/flusher)\r\n[![License](http://img.shields.io/packagist/l/endroid/flusher.svg)](https://packagist.org/packages/endroid/flusher)\r\n\r\nWhen you import or modify large amounts of data it is often necessary to define\r\nthe optimal batch size before flushing: small batch sizes perform bad because of\r\nthe overhead in each flush. And batch sizes that are too large perform bad because\r\nof the high memory usage and the need to calculate a large change set. Also the\r\nbatch size you choose can give different results on different types of hardware.\r\n\r\nThis library helps you write entities to the database without worrying about the\r\nbatch size. It incrementally tries new batch sizes (given a step size), sticks\r\nwith the one that gives the highest performance or switches to a better batch size\r\nif the circumstances have changed.\r\n\r\n## Installation\r\n\r\nUse [Composer](https://getcomposer.org/) to install the library.\r\n\r\n``` bash\r\n$ composer require endroid/flusher\r\n```\r\n\r\n## Usage\r\n\r\nIn order to enable auto flushing you first need to create a Flusher for the\r\nentity manager you are currently using.\r\n\r\n```php\r\n$flusher = new Flusher($manager);\r\n```\r\n\r\nThen when you performed operations on your entity manager you can call the\r\nflush() method on the flusher any time to notify there are changes.\r\n\r\n```php\r\nfor ($n = 1; $n \u003c= 50000; $n++) {\r\n    $task = new Task();\r\n    $task-\u003esetName('Task '.$n);\r\n    $manager-\u003epersist($task);\r\n    $flusher-\u003eflush();\r\n}\r\n```\r\n\r\nBecause there is no way of knowing if there are pending flushes at the end you\r\nneed to call finish() to make sure all data is flushed.\r\n\r\n```php\r\n$flusher-\u003efinish();\r\n```\r\n\r\n## Versioning\r\n\r\nVersion numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility\r\nbreaking changes will be kept to a minimum but be aware that these can occur.\r\nLock your dependencies for production and test your code when upgrading.\r\n\r\n## License\r\n\r\nThis bundle is under the MIT license. For the full copyright and license\r\ninformation please view the LICENSE file that was distributed with this source code.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendroid%2Fflusher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fendroid%2Fflusher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendroid%2Fflusher/lists"}