{"id":36332843,"url":"https://github.com/outman/dq","last_synced_at":"2026-01-11T12:01:35.780Z","repository":{"id":57034147,"uuid":"120071935","full_name":"outman/dq","owner":"outman","description":"PHP delay queue based on Redis.","archived":false,"fork":false,"pushed_at":"2018-02-20T09:24:00.000Z","size":13,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-23T10:50:58.711Z","etag":null,"topics":["delay-queue","queue","redis"],"latest_commit_sha":null,"homepage":null,"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/outman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-03T08:08:43.000Z","updated_at":"2022-10-23T12:40:19.000Z","dependencies_parsed_at":"2022-08-23T20:50:33.512Z","dependency_job_id":null,"html_url":"https://github.com/outman/dq","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/outman/dq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outman%2Fdq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outman%2Fdq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outman%2Fdq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outman%2Fdq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outman","download_url":"https://codeload.github.com/outman/dq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outman%2Fdq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28302004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T11:18:18.743Z","status":"ssl_error","status_checked_at":"2026-01-11T11:07:56.842Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["delay-queue","queue","redis"],"created_at":"2026-01-11T12:01:25.816Z","updated_at":"2026-01-11T12:01:35.752Z","avatar_url":"https://github.com/outman.png","language":"PHP","readme":"# dq\nPHP delay queue based on Redis. Just For Study.\n\n## Install\n\n```php\ncomposer require outman/dq\n```\n\n## Usage\n\n### Client\n\n```php\nrequire __DIR__ . '/vendor/autoload.php';\n\n$redisParams = [\n    'scheme' =\u003e 'tcp',\n    'host'   =\u003e '127.0.0.1',\n    'port'   =\u003e 6379,\n];\n\n$config = [\n    'params' =\u003e $redisParams // Predis/Client $params\n    // 'options' =\u003e [] // Predis/Client $options\n    // 'bucketCount' =\u003e DQ::DEFAULT_BUCKET_THREAD\n    // 'queueName' =\u003e DQ::DEFAULT_QUEUE,\n    // 'bucketPrefix' =\u003e DQ::DEFAULT_QUEUE_BUCKET,\n    // 'partialCount' =\u003e DQ::HASH_PARTIAL,\n];\n\n$queue = new DQ\\Client\\Queue($config);\n$queue-\u003eenqueue(mixed $value [, int $delaySeconds = 0]); // $value will be serialize.\n\n//// enqueue delay\nfor ($i = 0; $i \u003c= 10000; $i ++) {\n    mt_srand($i);\n    $dt = mt_rand(0, 100);// delay time seconds.\n    $ret = $queue-\u003eenqueue([\n        'dq' =\u003e sprintf('delay value - %07d - %d', $i, $dt),], $dt);\n\n    // if ($i % 10000) {\n    //     echo \"TEST-\", $i, PHP_EOL;\n    // }\n}\n\n//// dequeue\nwhile (true) {\n    $v = $queue-\u003edequeue();\n    if ($v) {\n        $v = json_encode($v) . PHP_EOL;\n        file_put_contents('deq_1.txt', $v, FILE_APPEND);\n        echo $v;\n    }\n}\n```\n\n### Server\n\n```php\n\u003c?php\nrequire __DIR__ . '/vendor/autoload.php';\n\n$redisParams = [\n    'scheme' =\u003e 'tcp',\n    'host'   =\u003e '127.0.0.1',\n    'port'   =\u003e 6379,\n];\n\n$config = [\n    'params' =\u003e $redisParams, // Predis/Client $params\n    // 'options' =\u003e [] // Predis/Client $options\n    // 'bucketCount' =\u003e DQ::DEFAULT_BUCKET_THREAD\n    // 'queueName' =\u003e DQ::DEFAULT_QUEUE,\n    // 'bucketPrefix' =\u003e DQ::DEFAULT_QUEUE_BUCKET,\n    // 'partialCount' =\u003e DQ::HASH_PARTIAL,\n];\n\n\n$scanner = new DQ\\Server\\Scanner($config);\n$scanner-\u003erun();\n\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutman%2Fdq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foutman%2Fdq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutman%2Fdq/lists"}