{"id":15323719,"url":"https://github.com/mvrilo/lua-libmemcached","last_synced_at":"2025-10-09T10:31:31.744Z","repository":{"id":137029143,"uuid":"12961569","full_name":"mvrilo/lua-libmemcached","owner":"mvrilo","description":"lua-libmemcached is a simple Lua binding for libmemcached.","archived":false,"fork":true,"pushed_at":"2013-09-19T23:23:14.000Z","size":106,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T19:02:14.556Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"leite/lua-libmemcached","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mvrilo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-19T23:15:46.000Z","updated_at":"2013-09-20T15:34:39.000Z","dependencies_parsed_at":"2023-03-14T12:00:50.999Z","dependency_job_id":null,"html_url":"https://github.com/mvrilo/lua-libmemcached","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mvrilo/lua-libmemcached","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Flua-libmemcached","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Flua-libmemcached/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Flua-libmemcached/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Flua-libmemcached/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mvrilo","download_url":"https://codeload.github.com/mvrilo/lua-libmemcached/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvrilo%2Flua-libmemcached/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001275,"owners_count":26083040,"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-09T02:00:07.460Z","response_time":59,"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":[],"created_at":"2024-10-01T09:21:23.764Z","updated_at":"2025-10-09T10:31:31.488Z","avatar_url":"https://github.com/mvrilo.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# summary\n\nlua-libmemcached is a simple [Lua](http://www.lua.org/) binding for [libmemcached](http://bit.ly/libmemcached).\n\n# help and support\n\nplease fill an issue or help it doing a clone and then a pull request.\n\n# license\n\n[BEER-WARE](http://bit.ly/b33rw4r3), see source\n\n# prerequisites\n\n+ [libmemcached](http://bit.ly/libmemcached) (of course) \n+ [Lua](http://www.lua.org/) ([Luajit](http://luajit.org/))\n+ [gcc](http://gcc.gnu.org/) and [make](http://www.gnu.org/software/make/) ([min-gw32](http://sourceforge.net/projects/mingw/files/MinGW/) on windows)\n+ [upx](http://upx.sourceforge.net/) (optional)\n\n# installation\n\ncompatible with *NIX systens, supposed to works on windows. You only need to edit some vars on makefile, for basic instalation use:\n\n    # make\n\nif you have upx use this for better output.\n  \n    # make release\n  \nfor cleanup\n\n    # make clean\n  \n# basic usage\n\n```lua\n\n--[[\n  \n  behavior*  = further reading http://bit.ly/b3h4v1or\n  ttl*/time* = (time to live) in seconds, optional, default 0 (indeterminate)\n  ttl**      = (time to live) in seconds, optional, default 0 (no changes last ttl)\n  offset*    = value offset, optional, default 1\n  **         = for async callback pass a function as last argument\n\n--]]\n\n-- useful variables\nlocal memc, inst, behavior, value, cas_token\nlocal key, value, key2, value2, n_key =\n      'foo', 'bar', 'fizz', 'buzz', 'rubber_duck'\n\nmemc = require 'lua-libmemcached'\n\n-- new \"libmemcached\", arguments are optional, return false unless successful.\n-- arguments: host/host:ip/unix socket/table of..., port/behavior(s)*\ninst = memc.new(\n    '127.0.0.1' or 'localhost:11211' or {'localhost:11211', {'10.1.1.66', 11211}},\n    11211 or {\"use_udp\", no_block=true, distribution='consistent'}\n  )\n\n\n-- add server(s)/port, port are optional, return true if successful.\ninst:add_server(\n    '10.1.1.66' or 'localhost:11211' or {'10.1.1.69:11211', {'10.1.1.69', 11212}},\n    11211\n  )\n\n\n-- set behavior(s)* flag, flag are optional, return true if successful.\ninst:set_behavior(\n    'tcp_nodelay' or {\"enable_cas\", use_binary=true}, false\n  )\n\n\n-- get behavior(s)* value, return table/value if successful.\nbehavior = inst:get_behavior('ketama_hash' or {\"distribution\", 'no_block'})\n\n\n-- add a key(s) with value(s), ttl*, returns true if successful. **\ninst:add(key or {[key]=value, [key2]=value2}, value, 3600 or 0)\n\n\n-- stores a value(s) in given key(s) with ttl*, returns true if successful. **\ninst:set(key or {[key2]=value2, [key]=value}, value, 7200 or 0)\n\n\n-- get value(s), cas token by key, returns false if not successful. **\nlocal value, cas_token = inst:get(key or {key, key2})\n\n\n-- replace a value(s), ttl* in given key(s), returns true if successful. **\n-- same as set, but fails if the key does not exist on the server\ninst:replace(key or {[key2]=value2, [key]=value}, value, 7200 or 0)\n\n\n-- compare and swap a key with value/ttl*, returns true if successful. **\ninst:cas(cas_token, key, value, 86400 or 0)\n\n\n-- appends data to value(s) in a given key(s), returns true if successful. **\ninst:append(key or {[key]=value, [key2]=value2}, value)\n\n\n-- prepends data to value(s) in a given key(s), returns true if successful. **\ninst:prepend(key or {[key2]=value2, [key]=value}, value)\n\n\n-- delete key(s) or delete with delayed time*, returns true if successful. **\ninst:delete(key or {[key]=value, [key2]=value2}, 60 or 0)\n\n\n-- increments value of a key with offset* and ttl** **\n-- returns new value or false if not successful.\ninst:incr(n_key, 10 or 1, 1800 or 0)\n\n\n-- decrements value of a key with offset* and ttl** **\n-- returns new value or false if not successful.\ninst:decr(n_key, 10 or 1, 1800 or 0)\n\n-- safe key checksum, returns false/true and string with message if error. **\nlocal checksum, err_str = inst:check_key(key2)\n\n``` \n\n# behaviors\n\ncheck the links below to more understanding on each subject.\n\n## optional\n\n**[use_binary](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)**: *boolean*, default true.\n\n**[use_udp](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_USE_UDP)**: *boolean*.\n\n**[no_block](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_NO_BLOCK)**: *boolean*.\n\n**[keepalive](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_KEEPALIVE)**: *boolean*.\n\n**[enable_cas](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_SUPPORT_CAS)**: *boolean*.\n\n**[tcp_nodelay](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_TCP_NODELAY)**: *boolean*.\n\n**[no_reply](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_NOREPLY)**: *boolean*.\n\n**[send_timeout](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_SND_TIMEOUT)**: in microseconds.\n\n**[receive_timeout](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_RCV_TIMEOUT)** in microseconds.\n\n**[connect_timeout](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT)** in microseconds.\n\n**[poll_timeout](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_POLL_TIMEOUT)** in seconds? - default -1.\n\n**[keepalive_idle](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_KEEPALIVE_IDLE)** in seconds, linux only.\n\n**[retry_timeout](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_RETRY_TIMEOUT)** in seconds.\n\n**[hash](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_HASH)**: \n  *[md5](http://bit.ly/h4sh3z#MEMCACHED_HASH_MD5)*,\n  *[crc](http://bit.ly/h4sh3z#MEMCACHED_HASH_CRC)*,\n  *[fnv1_64](http://bit.ly/h4sh3z#MEMCACHED_HASH_FNV1_64)*,\n  *[fnv1a_64](http://bit.ly/h4sh3z#MEMCACHED_HASH_FNV1A_64)*,\n  *[fnv1_32](http://bit.ly/h4sh3z#MEMCACHED_HASH_FNV1_32)*,\n  *[fnv1a_32](http://bit.ly/h4sh3z#MEMCACHED_HASH_FNV1A_32)*,\n  *[jenkins](http://bit.ly/h4sh3z#MEMCACHED_HASH_JENKINS)*,\n  *[hsieh](http://bit.ly/h4sh3z#MEMCACHED_HASH_HSIEH)*,\n  *[murmur](http://bit.ly/h4sh3z#MEMCACHED_HASH_MURMUR)*,\n  *[murmur3](http://bit.ly/h4sh3z#MEMCACHED_HASH_MURMUR3)* and\n  *[default](http://bit.ly/h4sh3z#MEMCACHED_HASH_DEFAULT)*\n\n**[ketama_hash](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_KETAMA_HASH)**: \n  *[md5](http://bit.ly/h4sh3z#MEMCACHED_HASH_MD5)*,\n  *[crc](http://bit.ly/h4sh3z#MEMCACHED_HASH_CRC)*,\n  *[fnv1_64](http://bit.ly/h4sh3z#MEMCACHED_HASH_FNV1_64)*,\n  *[fnv1a_64](http://bit.ly/h4sh3z#MEMCACHED_HASH_FNV1A_64)*,\n  *[fnv1_32](http://bit.ly/h4sh3z#MEMCACHED_HASH_FNV1_32)*,\n  *[fnv1a_32](http://bit.ly/h4sh3z#MEMCACHED_HASH_FNV1A_32)* and\n  *[default](http://bit.ly/h4sh3z#MEMCACHED_HASH_DEFAULT)*\n\n**[distribution](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_DISTRIBUTION)**: \n  *[modula](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_DISTRIBUTION)*,\n  *[consistent](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_DISTRIBUTION)*,\n  *[weighted](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED)*,\n  *[compat](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_KETAMA_COMPAT)* and\n  *[compat_spy](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_KETAMA_COMPAT)*\n\n## preset\n\n**[MEMCACHED_BEHAVIOR_VERIFY_KEY](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_VERIFY_KEY)**\n\n**[MEMCACHED_BEHAVIOR_HASH](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_HASH)**: \n  **[MEMCACHED_HASH_MURMUR](http://bit.ly/h4sh3z#MEMCACHED_HASH_MURMUR)**, (if murmur3 is unavailable) \n  **[MEMCACHED_HASH_MURMUR3](http://bit.ly/h4sh3z#MEMCACHED_HASH_MURMUR3)**\n\n**[MEMCACHED_BEHAVIOR_BINARY_PROTOCOL](http://bit.ly/b3h4v1or#MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)**\n\n# tests\n\nsee test.lua ...\n\n# TODO\n\n+ support callbacks\n+ support luvit module style\n+ create a test suite\n+ improve makefile\n\n% August 04th, 2013 -03 GMT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvrilo%2Flua-libmemcached","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmvrilo%2Flua-libmemcached","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvrilo%2Flua-libmemcached/lists"}