{"id":19885661,"url":"https://github.com/asmod4n/mruby-hiredis","last_synced_at":"2025-06-10T14:33:57.731Z","repository":{"id":76216419,"uuid":"47216320","full_name":"Asmod4n/mruby-hiredis","owner":"Asmod4n","description":"mruby bindings for https://github.com/redis/hiredis","archived":false,"fork":false,"pushed_at":"2024-04-02T16:14:05.000Z","size":161,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-02T16:54:57.102Z","etag":null,"topics":["hiredis","mruby","redis","redis-client"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Asmod4n.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2015-12-01T20:44:45.000Z","updated_at":"2022-05-08T17:03:02.000Z","dependencies_parsed_at":"2024-04-02T17:31:43.739Z","dependency_job_id":"569aa339-ba7d-45a7-bc8a-3022ef0e3409","html_url":"https://github.com/Asmod4n/mruby-hiredis","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asmod4n%2Fmruby-hiredis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asmod4n%2Fmruby-hiredis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asmod4n%2Fmruby-hiredis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asmod4n%2Fmruby-hiredis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Asmod4n","download_url":"https://codeload.github.com/Asmod4n/mruby-hiredis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Asmod4n%2Fmruby-hiredis/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259093170,"owners_count":22804132,"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":["hiredis","mruby","redis","redis-client"],"created_at":"2024-11-12T17:35:15.183Z","updated_at":"2025-06-10T14:33:57.597Z","avatar_url":"https://github.com/Asmod4n.png","language":"C","readme":"# mruby-hiredis\nmruby bindings for https://github.com/redis/hiredis\n\nExamples\n========\n\nConnect to the default redis-server\n```ruby\nhiredis = Hiredis.new\n```\n\nConnect to a tcp redis-server\n```ruby\nhiredis = Hiredis.new(\"localhost\", 6379) #if you leave the port out it defaults to 6379\n```\n\nConnect to a unix redis-server\n```ruby\nhiredis = Hiredis.new(\"/tmp/redis.sock\", -1) #set port to -1 so it connects to a unix socket\n```\n\nAll [Redis Commands](http://redis.io/commands) are mapped to Ruby Methods, this happens automatically when you connect the first time to a Server.\n```ruby\nhiredis[\"foo\"] = \"bar\"\nhiredis[\"foo\"]\nhiredis.incr(\"bar\")\n```\n\nIf you later on want to add more shortcut methods, because the first Server you connected to is of a lower version than the others, you can call\n```ruby\nHiredis.create_shortcuts(hiredis)\n```\n\nPipelining\n```ruby\nhiredis.queue(:set, \"foo\", \"bar\")\nhiredis.queue(:get, \"foo\")\nhiredis.bulk_reply\n```\n\nTransactions\n```ruby\nhiredis.transaction([:incr, \"bar\"], [:get, \"foo\"])\n```\n\nSubscriptions\n```ruby\nhiredis.subscribe('channel')\n\nloop do\n  puts hiredis.reply\nend\n```\n\nAsync Client\n------------\n\n```ruby\nasync = Hiredis::Async.new #(callbacks = Hiredis::Async::Callbacks.new, evloop = RedisAe.new, host_or_path = \"localhost\", port = 6379)\nasync.evloop.run_once\nasync.queue(:set, \"foo\", \"bar\")\nasync.evloop.run_once\nasync.queue(:get, \"foo\") {|reply| puts reply}\nasync.evloop.run_once\n```\n\nDisque\n------\n\nhttps://github.com/antirez/disque made it mandatory to change the way mruby-hiredis handles status replies, they have been symbols in the past, but are Strings now. This brakes pipelining and transactions for existing applications. Because of that the major version got incremented.\n\nReply Error Handling\n--------------\n\nWhen you get a reply back, you have to check if it is a \"Hiredis::ReplyError\", this was done so pipelined transactions can complete even if there are errors.\n\n\nAcknowledgements\n----------------\nThis is using code from https://github.com/redis/hiredis\n\nCopyright (c) 2009-2011, Salvatore Sanfilippo \u003cantirez at gmail dot com\u003e\nCopyright (c) 2010-2011, Pieter Noordhuis \u003cpcnoordhuis at gmail dot com\u003e\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice,\n  this list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of Redis nor the names of its contributors may be used\n  to endorse or promote products derived from this software without specific\n  prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasmod4n%2Fmruby-hiredis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasmod4n%2Fmruby-hiredis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasmod4n%2Fmruby-hiredis/lists"}