{"id":13792504,"url":"https://github.com/tarantool/memcached","last_synced_at":"2025-04-14T15:11:01.927Z","repository":{"id":2121640,"uuid":"43135716","full_name":"tarantool/memcached","owner":"tarantool","description":"Memcached protocol 'wrapper' for tarantool","archived":false,"fork":false,"pushed_at":"2025-04-11T05:56:29.000Z","size":312,"stargazers_count":29,"open_issues_count":31,"forks_count":9,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-04-11T06:32:48.931Z","etag":null,"topics":["memchached","tarantool"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tarantool.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-09-25T11:24:08.000Z","updated_at":"2025-03-13T00:03:50.000Z","dependencies_parsed_at":"2024-03-14T13:47:28.761Z","dependency_job_id":"9ed139e0-93a3-4930-a2bc-ae1f548a41be","html_url":"https://github.com/tarantool/memcached","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fmemcached","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fmemcached/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fmemcached/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fmemcached/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tarantool","download_url":"https://codeload.github.com/tarantool/memcached/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248904640,"owners_count":21180835,"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":["memchached","tarantool"],"created_at":"2024-08-03T22:01:12.983Z","updated_at":"2025-04-14T15:11:01.904Z","avatar_url":"https://github.com/tarantool.png","language":"C","funding_links":[],"categories":["Packages"],"sub_categories":["Database"],"readme":"\u003ca href=\"http://tarantool.org\"\u003e\n  \u003cimg src=\"https://avatars2.githubusercontent.com/u/2344919?v=2\u0026s=250\" align=\"right\"\u003e\n\u003c/a\u003e\n\n[![Static analysis](https://github.com/tarantool/memcached/actions/workflows/check.yaml/badge.svg)](https://github.com/tarantool/memcached/actions/workflows/check.yaml)\n[![Testing](https://github.com/tarantool/memcached/actions/workflows/testing.yaml/badge.svg)](https://github.com/tarantool/memcached/actions/workflows/testing.yaml)\n\n# memcached\n\nMemcached protocol 'wrapper' for Tarantool.\n\n## Getting started\n\n### Prerequisites\n\n * Tarantol 1.6.8+ with header files (tarantool \u0026\u0026 tarantool-dev packages).\n * Cyrus SASL library (with header files)\n * Python \u003e= 3.7 with next packages (for testing only):\n   - PyYAML 5+\n   - gevent 21+\n\n### Installation\n\nClone this repository and then build it using CMake:\n\n``` bash\ngit clone https://github.com/tarantool/memcached.git\ncd memcached\ngit submodule update --init --recursive\ncmake . -DCMAKE_BUILD_TYPE=RelWithDebugInfo -DCMAKE_INSTALL_PREFIX=/usr\nmake\nmake install\n```\n\nOr use LuaRocks (in this case you'll need `libsmall`, `libsmall-dev`, `tarantool-dev`\npackages available from our binary repository at http://tarantool.org/dist/master, and\nsystem package `libsasl2-dev`):\n\n``` bash\nluarocks install https://raw.githubusercontent.com/tarantool/memcached/master/rockspecs/memcached-scm-1.rockspec --local\n```\n\n### Usage\n\n``` bash\nbox.cfg{}\nlocal memcached = require('memcached')\nlocal instance = memcached.create('my_instance', '0.0.0.0:11211')\n```\n\nNow you're set up and ready to go!\n\n### How to connect\n\nInstall Tarantool package from repository ([described here](https://www.tarantool.io/download/)).\n\nPaste the previous example to `/etc/tarantool/instances.enabled/memcached.lua` and start it with\n`tarantoolctl start memcached`.\n\nThen try the following example:\n\n``` bash\n$ printf \"set key 0 60 5\\r\\nvalue\\r\\n\" | nc localhost 11211\nSTORED\n$ printf \"get key\\r\\n\" | nc localhost 11211\nVALUE key 0 5\nvalue\nEND\n$ printf \"set key2 0 60 6\\r\\nvalue2\\r\\n\" | nc localhost 11211\nSTORED\n$ printf \"get key key2\\r\\n\" | nc localhost 11211\nVALUE key 0 5\nvalue\nVALUE key2 0 6\nvalue2\nEND\n```\n\n## API\n\n* `local memcached = require('memcached')` - acquire a library handle\n* `local slab = memcached.slab.info()` - show information about slab arena and quota.\n* `local instance = memcached.create(\u003cname\u003e, \u003curi\u003e, \u003copts\u003e)` - create a new instance, register it and run\n  - `name` - a string with instance name\n  - `uri`  - a string with uri to bind to, for example: `0.0.0.0:11211` (only TCP is supported now)\n  - `opts` - a table with options, the list of possible options is described in the configuration section\n* `local instance = instance:cfg(\u003copts\u003e)` - (re)configure an existing instance.\n  `opts` - a table with options, same as in `create`\n* `local instance = instance:start()` - start an instance\n* `local instance = instance:stop()` - stop an instance\n* `local instance = instance:info()` - return execution statistics\n\n## Configuration\n\n* *readahead* - (default) size of readahead buffer for connection. default is `box-\u003ecfg-\u003ereadahead`\n* *expire_enabled* - availability of expiration daemon. default is `true`.\n* *expire_items_per_iter* - scan count for expiration (tuples processed in one transaction). default is 200.\n* *expire_full_scan_time* - time required for a full index scan (in seconds). default is 3600\n* *verbosity* - verbosity of memcached logging. default is 0.\n* ~~*flush_enabled* - flush command availability. default is true~~\n* *protocol* - the protocol, one of `negotiation`, `binary` or `text`.\n  - `negotiation` - detect the protocol automatically at handshake (the default)\n  - `binary` - binary memcached protocol\n  - `text` - text memcached protocol\n* *engine* - the engine to store data in\n  - `memory` - store everything in memory. (using `memtx` engine)\n  - ~~`disk` - store everything on hdd/ssd (using `vinyl` engine)~~ (not yet supported)\n* *space_name* - custom name for a memcached space, default is `__mc_\u003cinstance name\u003e`\n* *if_not_exists* - do not throw error if an instance already exists.\n* *sasl* - enable or disable SASL support (disabled by default)\n\n## SASL support\n\nUsual rules for memcached are applicable for this plugin:\n\n1. Create user (NOTE: it'll use custom folder):\n\n\t ``` bash\n\t echo testpass | saslpasswd2 -p -c testuser -f /tmp/test-tarantool-memcached.sasldb\n\t ```\n\n2. Place configuration file `/etc/sasl2/tarantool-memcached.conf`. For example:\n\n\t ```\n\t mech_list: plain cram-md5\n\t log_level: 7\n\t sasldb_path: /tmp/test-tarantool-memcached.sasldb\n\t ```\n\t\n\t NOTE: This will disable 'ANONYMOUS' (and other, that aren't listed)\n\t authentication plugins.\n\n\t NOTE: This will set logging level to the highest possible\n\n\t NOTE: This will set custom path for database path\n\n3. Run Tarantool with memcached plugin with SASL enabled\n\n\t ```lua\n\t local memcached = require('memcached')\n\t local instance = memcached.create('my_instance', '0.0.0.0:11211', {\n\t   sasl = true\n\t })\n\t```\n\n4. Use your favorite binary(!!) memcached client, that supports(!!) SASL:\n\n\t Example using Python's ['python-binary-memcached' library](https://github.com/jaysonsantos/python-binary-memcached)\n\t ```\n\t import bmemcached\n\t client = bmemcached.Client(('127.0.0.1:11211', ), 'testuser', 'testpasswd')\n\t client.set('key', 'value')\n\t print(client.get('key'))\n\t ```\n\nFor custom configuration file path, please, use `SASL_CONF_PATH` environment variable.\n\n## What's supported, what's not and other features\n\n**Everything is supported, unless the opposite is stated explicitly**\n\n* Text protocol commands:\n  - `set`/`add`/`cas`/`replace`/`append`/`prepend` commands (set section)\n  - `get`/`gets` commands (including multiget)\n  - `delete` command\n  - `incr`/`decr` commands\n  - `flush`/`version`/`quit` commands\n  - `verbosity` - partially, logging is not very good.\n  - `stat` - `reset` is supported and all stats too.\n* Binary protocol's commands:\n  - `get`/`getk`/`getq`/`getkq` commands (get section)\n  - `add`/`addq`/`replace`/`replaceq`/`set`/`setq` commands (set section)\n  - `quit`/`quitq`/`flush`/`flushq`/`noop`/`version` commands\n  - `gat`/`gatq`/`touch`/`gatk`/`gatkq` commands\n  - `append`/`prepend`/`incr`/`decr`\n  - `verbosity` - partially, logging is not very good.\n  - `stat` - `reset` is supported and all stats too.\n  - **SASL** authentication is supported\n  - **range** operations are not supported as well.\n* Expiration is supported\n* Flush is supported\n* The protocol is synchronous\n* Full support of Tarantool means of consistency (write-ahead logs, snapshots, replication)\n* You can access data from Lua\n* for now LRU is not supported\n* TAP is not supported (for now)\n* VBucket is not supported (for now)\n* UDP/UNIX sockets are not supported (for now)\n\n## Caution\n\nThis rock is in early beta.\n\n## Hacking\n\nWe're collecting information for the module developers in the\n[HACKING.md](HACKING.md) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarantool%2Fmemcached","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarantool%2Fmemcached","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarantool%2Fmemcached/lists"}