{"id":15048372,"url":"https://github.com/github/memcached","last_synced_at":"2025-10-04T08:31:32.460Z","repository":{"id":65974870,"uuid":"452759701","full_name":"github/memcached","owner":"github","description":"A Ruby interface to the libmemcached C client","archived":false,"fork":true,"pushed_at":"2024-12-03T22:59:41.000Z","size":15078,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"github","last_synced_at":"2024-12-03T23:29:58.685Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"arthurnn/memcached","license":"afl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/github.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","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":"2022-01-27T16:33:14.000Z","updated_at":"2024-11-19T00:36:29.000Z","dependencies_parsed_at":"2023-02-19T18:01:20.609Z","dependency_job_id":null,"html_url":"https://github.com/github/memcached","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fmemcached","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fmemcached/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fmemcached/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fmemcached/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/memcached/tar.gz/refs/heads/github","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235232529,"owners_count":18957057,"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":[],"created_at":"2024-09-24T21:11:11.625Z","updated_at":"2025-10-04T08:31:26.966Z","avatar_url":"https://github.com/github.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# memcached\n\nAn interface to the libmemcached C client.\n[![Build Status](https://github.com/arthurnn/memcached/workflows/CI/badge.svg?branch=1-0-stable)](https://github.com/arthurnn/memcached/actions?query=branch%3A1-0-stable)\n\n## License\n\nCopyright 2009-2013 Cloudburst, LLC. Licensed under the AFL 3. See the\nincluded LICENSE file. Portions copyright 2007-2009 TangentOrg, Brian Aker,\nlicensed under the BSD license, and used with permission.\n\n## Features\n\n*   clean API\n*   robust access to all memcached features\n*   SASL support for the binary protocol\n*   multiple hashing modes, including consistent hashing\n*   ludicrous speed, including optional pipelined IO with no_reply\n\n\nThe **memcached** library wraps the pure-C libmemcached client via SWIG.\n\n## Installation\n\nYou need Ruby 1.8.7 or Ruby 1.9.2. Other versions may work, but are not\nguaranteed. You also need the `libsasl2-dev` and `gettext` libraries, which\nshould be provided through your system's package manager.\n\nInstall the gem:\n    sudo gem install memcached --no-rdoc --no-ri\n\n## Usage\n\nStart a local networked memcached server:\n    $ memcached -p 11211 \u0026\n\nNow, in Ruby, require the library and instantiate a Memcached object at a\nglobal level:\n\n    require 'memcached'\n    $cache = Memcached.new(\"localhost:11211\")\n\nNow you can set things and get things:\n\n    value = 'hello'\n    $cache.set 'test', value\n    $cache.get 'test' #=\u003e \"hello\"\n\nYou can set with an expiration timeout:\n\n    value = 'hello'\n    $cache.set 'test', value, 1\n    sleep(2)\n    $cache.get 'test' #=\u003e raises Memcached::NotFound\n\nYou can get multiple values at once:\n\n    value = 'hello'\n    $cache.set 'test', value\n    $cache.set 'test2', value\n    $cache.get ['test', 'test2', 'missing']\n      #=\u003e {\"test\" =\u003e \"hello\", \"test2\" =\u003e \"hello\"}\n\nYou can set a counter and increment it. Note that you must initialize it with\nan integer, encoded as an unmarshalled ASCII string:\n\n    start = 1\n    $cache.set 'counter', start.to_s, 0, false\n    $cache.increment 'counter' #=\u003e 2\n    $cache.increment 'counter' #=\u003e 3\n    $cache.get('counter', false).to_i #=\u003e 3\n\nYou can get some server stats:\n\n    $cache.stats #=\u003e {..., :bytes_written=\u003e[62], :version=\u003e[\"1.2.4\"] ...}\n\nNote that the API is not the same as that of **Ruby-MemCache** or\n**memcache-client**. In particular, `nil` is a valid record value.\nMemcached#get does not return `nil` on failure, rather it raises\n**Memcached::NotFound**. This is consistent with the behavior of memcached\nitself. For example:\n\n    $cache.set 'test', nil\n    $cache.get 'test' #=\u003e nil\n    $cache.delete 'test'\n    $cache.get 'test' #=\u003e raises Memcached::NotFound\n\n## Rails 3 and 4\n\nUse [memcached_store gem](https://github.com/Shopify/memcached_store) to\nintegrate ActiveSupport cache store and memcached gem\n\n## Pipelining\n\nPipelining updates is extremely effective in **memcached**, leading to more\nthan 25x write throughput than the default settings. Use the following options\nto enable it:\n\n    :no_block =\u003e true,\n    :buffer_requests =\u003e true,\n    :noreply =\u003e true,\n    :binary_protocol =\u003e false\n\nCurrently #append, #prepend, #set, and #delete are pipelined. Note that when\nyou perform a read, all pending writes are flushed to the servers.\n\n## Threading\n\n**memcached** is threadsafe, but each thread requires its own Memcached\ninstance. Create a global Memcached, and then call Memcached#clone each time\nyou spawn a thread.\n\n    thread = Thread.new do\n      cache = $cache.clone\n      # Perform operations on cache, not $cache\n      cache.set 'example', 1\n      cache.get 'example'\n    end\n\n    # Join the thread so that exceptions don't get lost\n    thread.join\n\n## Legacy applications\n\nThere is a compatibility wrapper for legacy applications called\nMemcached::Rails.\n\n## Benchmarks\n\n**memcached**, correctly configured, is at least twice as fast as\n**memcache-client** and **dalli**. See link:BENCHMARKS for details.\n\n## Reporting problems\n\nThe support forum is [here](http://github.com/evan/memcached/issues).\n\nPatches and contributions are very welcome. Please note that contributors are\nrequired to assign copyright for their additions to Cloudburst, LLC.\n\n## Further resources\n\n*   [Memcached wiki](https://github.com/memcached/memcached/wiki)\n*   [Libmemcached homepage](libmemcached.org)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fmemcached","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fmemcached","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fmemcached/lists"}