{"id":21655865,"url":"https://github.com/dalssoft/memcached.js","last_synced_at":"2025-04-11T21:31:01.073Z","repository":{"id":1296307,"uuid":"1238304","full_name":"dalssoft/memcached.js","owner":"dalssoft","description":"Port of Memcached server for Node.js","archived":false,"fork":false,"pushed_at":"2022-04-16T13:39:06.000Z","size":87,"stargazers_count":70,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T17:22:58.294Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dalssoft.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}},"created_at":"2011-01-10T15:32:05.000Z","updated_at":"2024-10-22T07:34:59.000Z","dependencies_parsed_at":"2022-08-16T13:00:27.409Z","dependency_job_id":null,"html_url":"https://github.com/dalssoft/memcached.js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalssoft%2Fmemcached.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalssoft%2Fmemcached.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalssoft%2Fmemcached.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalssoft%2Fmemcached.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dalssoft","download_url":"https://codeload.github.com/dalssoft/memcached.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248482874,"owners_count":21111397,"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-11-25T08:37:27.080Z","updated_at":"2025-04-11T21:31:01.020Z","avatar_url":"https://github.com/dalssoft.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"    ______  ___                                        ______        _________  _________________\r\n    ___   |/  /_____ _______ ___ _____________ ___________  /_ _____ ______  /  ______  /__  ___/\r\n    __  /|_/ / _  _ \\__  __ `__ \\_  ___/_  __ `/_  ___/__  __ \\_  _ \\_  __  /   ___ _  / _____ \\\r\n    _  /  / /  /  __/_  / / / / // /__  / /_/ / / /__  _  / / //  __// /_/ /___ / /_/ /  ____/ /\r\n    /_/  /_/   \\___/ /_/ /_/ /_/ \\___/  \\__,_/  \\___/  /_/ /_/ \\___/ \\__,_/ _(_)\\____/   /____/\r\n\r\n# Memcached.js\r\nMemcached.js is a port of [Memcached](http://memcached.org/) to Javascript, running on Node.Js.\r\n\r\n## Install\r\n\r\n```bash\r\n  $ git clone git://github.com/dalssoft/memcached.js.git\r\n  $ cd memcached.js\r\n  $ ./bin/memcachedjs\r\n```\r\n\r\n## What does it do?\r\n\r\nFrom the original project:\r\n\r\n\"Free \u0026 open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.\r\n\r\nMemcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.\"\r\n\r\nThis version:\r\n\r\n* Non blocking operations: \"take near constant time to execute, no matter how much data is in the cache.\"\r\n  * Well, not completely true: adding and removing items to cache allocate memory dynamically, because it doesn't allocate memory upfront when the server starts. So, it may take sometime allocating memory. We will fix it in the future, but for now, it probably won't hurt you.\r\n  * On the other hand, the cache operates on algorithms with O(1) complexity. No complex timers / triggers. Just a hash and linked list.\r\n  * And of course, it uses the non-blocking event machine provided by Node.js\r\n* Supported commands on this version: get, set, flush_all, delete, add, replace, stats\r\n* ASCII and Binary memcached protocol\r\n\r\n\r\n## What it doesn't do (yet)?\r\n\r\n* It is not a client for memcached\r\n* UDP protocol\r\n* cas, gets, append, prepend, version, quit, incr and decr commands\r\n* delete queue\r\n* stats command with params\r\n* Pre-allocate memory or pagination\r\n* Sophisticated cache strategies. All it does right now is the old and good LRU, for all items. No discrimination.\r\n  * However, now it uses the same heuristic that the original project uses to clean expired items when it needs more space.\r\n\r\n## Project goals (sanity is not a prerequirement)\r\n\r\n1. Reach the same performance as C implementation\r\n2. Implement the same set of features the original project have\r\n3. Be a hackable memcached implementation\r\n\r\n##   When Memory Is Reclaimed\r\nMemory for an item is not actively reclaimed. If you store an item and it expires, it sits in the LRU cache at its position until it falls to the end and is reused.\r\n\r\nHowever, if you fetch an expired item, memcached.js will find the item, notice that it's expired, and free its memory. This gives you the common case of normal cache churn reusing its own memory.\r\n\r\nItems can also be evicted to make way for new items that need to be stored. But before that, we will try to drop a few expired items at the end of the list.\r\n\r\n## Current State\r\nCurrently, the project is Alpha (version 0.0.4), not tested in production enviroment. However, it was tested using diferent scenarios and condition, with different clients (see /test/from_clients folder and the list below).\r\n\r\nI haven't done any serious performance test, just simple ones. Compared with the original memcached written in C, memcached.js performance is between 30% and 50% slower. The situation may worsen as new functionality is added (currently, it's ~ 1000 of javascript LOC against ~ 7500 of C LOC, according to [CLOC](http://sourceforge.net/projects/cloc/)). At the same time, it can be improved since no optimization has been done yet and I can see many places where it could do better.\r\n\r\nTested on Node.js since version v0.3.6-pre. Last check: Node.js v6.3.0\r\n\r\nClients tested:\r\n\r\nC/C++:\r\n- [memcslap](https://code.launchpad.net/libmemcached)\r\n\r\nRuby:\r\n\r\n- [Ruby MemCache Client](http://deveiate.org/projects/RMemCache/)\r\n\r\n- [memcache-client](http://rubygems.org/gems/memcache-client/versions/1.8.5)\r\n\r\nNode.js:\r\n\r\n- [node-memcache](https://github.com/vanillahsu/node-memcache)\r\n\r\nPerl:\r\n\r\n- [damemtop](https://github.com/dormando/damemtop)\r\n\r\n- [memcache-top](http://code.google.com/p/memcache-top/)\r\n\r\n\r\n## Using Memcached.js\r\n\r\n```bash\r\n  $ cd memcached.js\r\n  $ ./bin/memcachedjs --log 1\r\n```\r\n\r\nOn the client side:\r\n\r\n```bash\r\n  $ telnet localhost 11211\r\n  stats\r\n```\r\n\r\nTest:\r\n\r\n```bash\r\n  $ rspec -fd -c test/from_clients/ruby_spec_test.rb\r\n```\r\n\r\n## Implemented commands\r\n\r\n              ASCII    Bin\r\n    Get         X       X\r\n    Set         X       X\r\n    Add         X       X\r\n    Replace     X       X\r\n    Delete      X       X\r\n    Increment\r\n    Decrement\r\n    Quit\r\n    Flush       X       X\r\n    GetQ\r\n    No-op               X\r\n    Version             X\r\n    GetK\r\n    GetKQ               X\r\n    Append\r\n    Prepend\r\n    Stat        X\r\n    SetQ\r\n    AddQ\r\n    ReplaceQ\r\n    DeleteQ\r\n    IncrementQ\r\n    DecrementQ\r\n    QuitQ\r\n    FlushQ\r\n    AppendQ\r\n    PrependQ\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalssoft%2Fmemcached.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdalssoft%2Fmemcached.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalssoft%2Fmemcached.js/lists"}