{"id":25228879,"url":"https://github.com/plainbanana/redis-cluster-fast","last_synced_at":"2026-02-13T23:31:38.351Z","repository":{"id":65659126,"uuid":"594111149","full_name":"plainbanana/Redis-Cluster-Fast","owner":"plainbanana","description":"A fast Perl binding for Redis Cluster","archived":false,"fork":false,"pushed_at":"2025-01-30T19:14:53.000Z","size":254,"stargazers_count":1,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T20:25:32.313Z","etag":null,"topics":["perl","redis","redis-cluster-client"],"latest_commit_sha":null,"homepage":"https://metacpan.org/pod/Redis::Cluster::Fast","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plainbanana.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"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}},"created_at":"2023-01-27T16:17:35.000Z","updated_at":"2025-01-28T17:36:07.000Z","dependencies_parsed_at":"2024-12-27T20:18:09.127Z","dependency_job_id":"75906c7d-52e3-4f6b-b685-1d9e4e788d1e","html_url":"https://github.com/plainbanana/Redis-Cluster-Fast","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plainbanana%2FRedis-Cluster-Fast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plainbanana%2FRedis-Cluster-Fast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plainbanana%2FRedis-Cluster-Fast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plainbanana%2FRedis-Cluster-Fast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plainbanana","download_url":"https://codeload.github.com/plainbanana/Redis-Cluster-Fast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238281044,"owners_count":19446078,"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":["perl","redis","redis-cluster-client"],"created_at":"2025-02-11T10:46:10.804Z","updated_at":"2025-10-26T06:31:22.137Z","avatar_url":"https://github.com/plainbanana.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/plainbanana/Redis-Cluster-Fast/workflows/test/badge.svg)](https://github.com/plainbanana/Redis-Cluster-Fast/actions) [![MetaCPAN Release](https://badge.fury.io/pl/Redis-Cluster-Fast.svg)](https://metacpan.org/release/Redis-Cluster-Fast)\n# NAME\n\nRedis::Cluster::Fast - A fast perl binding for Redis Cluster\n\n# SYNOPSIS\n\n    use Redis::Cluster::Fast;\n\n    Redis::Cluster::Fast::srandom(100);\n\n    my $redis = Redis::Cluster::Fast-\u003enew(\n        startup_nodes =\u003e [\n            'localhost:9000',\n            'localhost:9001',\n            'localhost:9002',\n            'localhost:9003',\n            'localhost:9004',\n            'localhost:9005',\n        ],\n        connect_timeout =\u003e 0.05,\n        command_timeout =\u003e 0.05,\n        max_retry_count =\u003e 10,\n    );\n\n    $redis-\u003eset('test', 123);\n\n    # '123'\n    my $str = $redis-\u003eget('test');\n\n    $redis-\u003emset('{my}foo', 'hoge', '{my}bar', 'fuga');\n\n    # get as array-ref\n    my $array_ref = $redis-\u003emget('{my}foo', '{my}bar');\n    # get as array\n    my @array = $redis-\u003emget('{my}foo', '{my}bar');\n\n    $redis-\u003ehset('mymap', 'field1', 'Hello');\n    $redis-\u003ehset('mymap', 'field2', 'ByeBye');\n\n    # get as hash-ref\n    my $hash_ref = { $redis-\u003ehgetall('mymap') };\n    # get as hash\n    my %hash = $redis-\u003ehgetall('mymap');\n\n# DESCRIPTION\n\nRedis::Cluster::Fast is like [Redis::Fast](https://github.com/shogo82148/Redis-Fast) but support Redis Cluster by [hiredis-cluster](https://github.com/Nordix/hiredis-cluster).\n\nTo build and use this module you need libevent-dev \u003e= 2.x is installed on your system.\n\nRecommend Redis 6 or higher.\n\nSince Redis 6, it supports new version of Redis serialization protocol, [RESP3](https://github.com/antirez/RESP3/blob/master/spec.md).\nThis client start to connect using RESP2 and currently it has no option to upgrade all connections to RESP3.\n\n## MICROBENCHMARK\n\nSimple microbenchmark comparing PP and XS.\nThe benchmark script used can be found under examples directory.\nEach operation was executed 100,000 times, and the execution time was measured in milliseconds.\n\n    +--------------------------------+-------+-------+-------+-------+-------+\n    | Operation                      | P50   | P80   | P95   | P99   | P100  |\n    +--------------------------------+-------+-------+-------+-------+-------+\n    | get_pp                         | 0.028 | 0.032 | 0.036 | 0.050 | 0.880 |\n    | get_xs                         | 0.020 | 0.023 | 0.025 | 0.044 | 0.881 |\n    | get_xs_pipeline                | 0.014 | 0.015 | 0.018 | 0.021 | 0.472 |\n    | get_xs_pipeline_batched_100    | 0.003 | 0.003 | 0.004 | 0.074 | 0.323 |\n    | set_pp                         | 0.028 | 0.032 | 0.037 | 0.051 | 2.014 |\n    | set_xs                         | 0.021 | 0.024 | 0.027 | 0.047 | 0.729 |\n    | set_xs_pipeline                | 0.014 | 0.016 | 0.018 | 0.021 | 0.393 |\n    | set_xs_pipeline_batched_100    | 0.003 | 0.004 | 0.005 | 0.073 | 0.379 |\n    +--------------------------------+-------+-------+-------+-------+-------+\n\nc.f. https://github.com/plainbanana/Redis-Cluster-Fast-Benchmarks\n\n# METHODS\n\n## srandom($seed)\n\nhiredis-cluster uses [random()](https://linux.die.net/man/3/random) to select a node used for requesting cluster topology.\n\n`$seed` is expected to be an unsigned integer value,\nand is used as an argument for [srandom()](https://linux.die.net/man/3/srandom).\n\nThese are different implementations of Perl's rand and srand.\nIn this client, Perl's Drand01 is also used to determine the destination node for executing a command that is not a cluster command.\n\n## new(%args)\n\nFollowing arguments are available.\n\n### startup\\_nodes\n\nSpecifies the list of Redis Cluster nodes.\n\n### connect\\_timeout\n\nA fractional seconds. (default: 1.0)\n\nConnection timeout to connect to a Redis node.\n\n### command\\_timeout\n\nA fractional seconds. (default: 1.0)\n\nSpecifies the timeout value for each read/write event to execute a Redis Command.\n\n### max\\_retry\\_count\n\nA integer value. (default: 5)\n\nThe client will retry calling the Redis Command only if it successfully get one of the following error responses.\nMOVED, ASK, TRYAGAIN, CLUSTERDOWN.\n\n`max_retry_count` is the maximum number of retries and must be 1 or above.\n\n### cluster\\_discovery\\_retry\\_timeout\n\nA fractional value. (default: 1.0)\n\nSpecify the number of seconds to treat a series of cluster topology requests as timed out without retrying the operation.\nAt least one operation will be attempted, and the time taken for the initial operation will also be measured.\n\n### route\\_use\\_slots\n\nA value used as boolean. (default: undef)\n\nThe client will call CLUSTER SLOTS instead of CLUSTER NODES.\n\n## \u0026lt;command\u003e(@args)\n\nTo run a Redis command with arguments.\n\nThe command can also be expressed by concatenating the subcommands with underscores.\n\n    e.g. cluster_info\n\nIt does not support (Sharded) Pub/Sub family of commands and should not be run.\n\nIt is recommended to issue `disconnect` in advance just to be safe when executing fork() after issuing the command.\n\n## \u0026lt;command\u003e(@args, sub {})\n\nTo run a Redis command in pipeline with arguments and a callback.\n\nThe command can also be expressed by concatenating the subcommands with underscores.\n\nCommands issued to the same node are sent and received in pipeline mode.\nIn pipeline mode, commands are not sent to Redis until `run_event_loop`, `wait_one_response` or `wait_all_responses` is issued.\n\nThe callback is executed with two arguments.\nThe first is the result of the command, and the second is the error message.\n`$result` will be a scalar value or an array reference, and `$error` will be an undefined value if no errors occur.\nAlso, `$error` may contain an error returned from Redis or an error that occurred on the client (e.g. Timeout).\n\nYou cannot call any client methods or exceptions inside the callback.\n\nAfter issuing a command in pipeline mode,\ndo not execute fork() without issuing `disconnect` if all callbacks are not executed completely.\n\n    $redis-\u003eget('test', sub {\n        my ($result, $error) = @_;\n        # some operations...\n    });\n\n## run\\_event\\_loop()\n\nThis method is nonblocking and allows you to issue commands without waiting for their responses.\n\nIf there are unsent commands, they will be pipelined and sent,\nand if there are already-received responses, their corresponding callbacks will be executed.\nWhen a timeout occurs, an error will be propagated to the corresponding callback(s).\n\nThe return value can be either 1 for success\n(e.g., commands sent, responses read, or exit without waiting for any responses),\n0 for no callbacks remained, or undef for other errors.\n\n### Notes\n\n- If a timeout occurs, all remaining commands on that node will time out as well.\n- For a simpler, synchronous-like usage where you need at least one response,\nrefer to `wait_one_response`. If you only need to block until all\npending commands are processed, see `wait_all_responses`.\n\n### Example\n\n    # Queue multiple commands in pipeline mode\n    $redis-\u003eset('key1', 'value1', sub {});\n    $redis-\u003eget('key2', sub {});\n\n    # Send commands to Redis without waiting for responses\n    $redis-\u003erun_event_loop();\n\n    # If any responses are available, read them immediately without waiting for the rest\n    $redis-\u003erun_event_loop();\n\n## wait\\_one\\_response()\n\nIf there are any unexecuted callbacks, it will block until at least one is executed.\nThe return value can be either 1 for success, 0 for no callbacks remained, or undef for other errors.\n\n## wait\\_all\\_responses()\n\nIf there are any unexecuted callbacks, it will block until all of them are executed.\nThe return value can be either 1 for success, 0 for no callbacks remained, or undef for other errors.\n\n## disconnect()\n\nNormally you should not call `disconnect` manually.\nIf you want to call fork(), `disconnect` should be call before fork().\n\nIt will be blocked until all unexecuted commands are executed, and then it will disconnect.\n\n## connect()\n\nNormally you should not call `connect` manually.\nIf you want to call fork(), `connect` should be call after fork().\n\n# LICENSE\n\nCopyright (C) plainbanana.\n\nThis library is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself.\n\n# AUTHOR\n\nplainbanana \u003cplainbanana@mustardon.tokyo\u003e\n\n# SEE ALSO\n\n- [Redis::ClusterRider](https://github.com/iph0/Redis-ClusterRider)\n- [Redis::Fast](https://github.com/shogo82148/Redis-Fast)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplainbanana%2Fredis-cluster-fast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplainbanana%2Fredis-cluster-fast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplainbanana%2Fredis-cluster-fast/lists"}