{"id":25400557,"url":"https://github.com/sadaf2005/recache","last_synced_at":"2026-02-23T00:04:22.930Z","repository":{"id":277668994,"uuid":"933142309","full_name":"Sadaf2005/ReCache","owner":"Sadaf2005","description":"A lightweight, custom implementation of a Redis-like server built from scratch using Node.js. This server supports a subset of Redis commands and features, providing a simple yet powerful in-memory key-value store with additional functionality like transactions, expiry, multiple execution  and persistence.","archived":false,"fork":false,"pushed_at":"2025-02-15T11:22:48.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T00:49:11.979Z","etag":null,"topics":["docker","docker-image","javascript","nodejs","parser-library","redis","redis-cache","redis-server"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sadaf2005.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-15T08:46:32.000Z","updated_at":"2025-02-15T11:22:51.000Z","dependencies_parsed_at":"2025-02-15T10:25:41.518Z","dependency_job_id":"7dba84c2-1cc3-43e7-b53f-ed5dcf65de50","html_url":"https://github.com/Sadaf2005/ReCache","commit_stats":null,"previous_names":["sadaf2005/recache"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sadaf2005%2FReCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sadaf2005%2FReCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sadaf2005%2FReCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sadaf2005%2FReCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sadaf2005","download_url":"https://codeload.github.com/Sadaf2005/ReCache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501913,"owners_count":21114681,"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":["docker","docker-image","javascript","nodejs","parser-library","redis","redis-cache","redis-server"],"created_at":"2025-02-16T00:18:26.094Z","updated_at":"2026-02-23T00:04:22.922Z","avatar_url":"https://github.com/Sadaf2005.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReCache: A Custom Redis Server\n\n## Project Overview\n\nThis project, ReCache, is a custom implementation of a Redis-like in-memory data structure store built using **Node.js**. It provides a lightweight, in-memory key-value store designed to replicate some of the core functionalities and behaviors of the popular open-source Redis server. The goal is to offer a deeper understanding of how such high-performance data stores work, while being simple, extensible, and easy to use for learning, testing, or lightweight applications.\n\n## 🚀 Features\n\nReCache is under active development and currently supports a range of fundamental Redis-like features:\n\n* **GET \u0026 SET:** Store and retrieve key-value pairs.\n* **INCR \u0026 DECR:** Perform atomic increment and decrement operations on numeric values.\n* **Lists (LPUSH, RPUSH, LPOP, RPOP, LRANGE):** Implement list operations for managing ordered sequences of elements, suitable for queue-like behaviors.\n* **EXPIRE \u0026 TTL:** Set a time-to-live (TTL) for keys, allowing for automatic expiration.\n* **DEL:** Remove keys and their associated values from storage.\n* **Persistence:** Data is saved inside a Docker container for basic durability.\n* **Transaction Support (MULTI, EXEC, DISCARD):** (Planned) Support for atomic execution of command batches.\n* **Pub/Sub:** (Coming Soon) A real-time messaging system for publish/subscribe functionality.\n\n## Motivation\n\nThe primary motivations behind building ReCache include:\n\n* **Educational Purposes:** To gain a comprehensive understanding of the internal workings of an in-memory data store like Redis, including network programming, data structure management, and protocol implementation.\n* **Exploring Performance:** To experiment with different implementation techniques and data structures in Node.js to understand their impact on performance.\n* **Customization and Specialization:** To create a base for building a data store with specific optimizations or features not present in the standard Redis.\n* **Skill Development:** To enhance skills in Node.js development, network programming, and understanding database internals.\n\n## Tech Stack\n\nReCache is built using the following technologies:\n\n* **Core Programming Language:** Node.js\n* **Protocol Parsing:** Likely utilizes a library like `redis-parser` for handling the Redis Serialization Protocol (RESP).\n* **Data Structures:** Custom or built-in Node.js data structures for key-value storage and list implementations.\n* **Networking:** Node.js's built-in networking modules for handling TCP connections.\n\n## 📦 Setup \u0026 Installation\n\nTo get a local copy of ReCache up and running, follow these steps:\n\n1. **Clone the Repository:**\n\n   ```bash\n   git clone https://github.com/Sadaf2005/ReCache.git\n   ```\n\n2. **Navigate to the project directory:**\n\n   ```bash\n   cd ReCache\n   ```\n\n3. **Install Dependencies:**\n   *(Assuming a `package.json` with dependencies)*\n\n   ```bash\n   npm install\n   # or yarn install\n   ```\n\n4. **Start the ReCache Server:**\n   Run the server in one terminal:\n\n   ```bash\n   node index.js\n   ```\n   The server should start and listen on port `8001`.\n\n5. **Start a Docker Container for Persistence (Optional but Recommended):**\n   Ensure Docker is installed, then build your Docker image (if you haven't already, based on a provided Dockerfile in the repo) and run:\n\n   ```bash\n   docker build -t recache-image . # Build the image if a Dockerfile exists\n   docker run --name recache-container -v $(pwd)/data:/data -d recache-image\n   ```\n   (Replace `recache-image` with your actual image name if different.)\n\n   To restart the container after stopping it:\n\n   ```bash\n   docker start recache-container\n   ```\n\n## Quick Guide to Test the Server\n\nYou can connect to the ReCache server using the `redis-cli` tool (assuming you have it installed) or other compatible Redis clients.\n\nOpen another terminal and run:\n\n```bash\nredis-cli -p 8001\n```\n\n### Supported Commands\n\n#### Basic Commands\n```\n127.0.0.1:8001\u003e SET mykey \"Hello, World!\"\n+OK\n127.0.0.1:8001\u003e GET mykey\n$13\nHello, World!\n127.0.0.1:8001\u003e DEL mykey\n:1\n127.0.0.1:8001\u003e SET counter 10\n+OK\n127.0.0.1:8001\u003e INCR counter\n:11\n127.0.0.1:8001\u003e DECR counter\n:10\n```\n\n#### List Commands\n```\n127.0.0.1:8001\u003e LPUSH mylist \"item1\"\n:1\n127.0.0.1:8001\u003e RPUSH mylist \"item2\"\n:2\n127.0.0.1:8001\u003e LPOP mylist\n$5\nitem1\n127.0.0.1:8001\u003e RPOP mylist\n$5\nitem2\n127.0.0.1:8001\u003e LRANGE mylist 0 -1\n*0\n```\n\n#### Expiry Commands\n```\n127.0.0.1:8001\u003e SET tempkey \"tempvalue\"\n+OK\n127.0.0.1:8001\u003e EXPIRE tempkey 10\n:1\n127.0.0.1:8001\u003e TTL tempkey\n:8\n```\n\n#### Transaction Commands (If Implemented)\n```\n127.0.0.1:8001\u003e MULTI\n+OK\n127.0.0.1:8001\u003e SET key1 \"value1\"\n+QUEUED\n127.0.0.1:8001\u003e INCR counter\n+QUEUED\n127.0.0.1:8001\u003e EXEC\n*2\n+OK\n:11\n127.0.0.1:8001\u003e MULTI\n+OK\n127.0.0.1:8001\u003e SET key2 \"value2\"\n+QUEUED\n127.0.0.1:8001\u003e DISCARD\n+OK\n```\n\n## Future Enhancements\n\nThe following features are planned for future development:\n\n* Support for more data types (e.g., sets, hashes, sorted sets)\n* Implement clustering for horizontal scaling\n* Add authentication and security features\n* Optimize performance and add benchmarking\n* Full implementation of Pub/Sub\n\n## Contributing\n\nContributions to ReCache are welcome! If you find bugs, have suggestions for improvements, or want to add new features, feel free to:\n\n1. Fork the repository\n2. Create a new branch (`git checkout -b feature/your-feature`)\n3. Make your changes\n4. Commit your changes (`git commit -am 'Add some feature'`)\n5. Push to the branch (`git push origin feature/your-feature`)\n6. Create a new Pull Request\n\nPlease ensure your code adheres to any existing coding styles and includes appropriate tests if applicable.\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n## Acknowledgments\n\n* Inspired by the official Redis project\n* Built using Node.js and potentially the `redis-parser` library *(Confirm library usage from code)*\n\n## Connect with Me\n\n* GitHub: [github.com/Sadaf2005]\n* Email: [alisadaf434@gmail.com]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsadaf2005%2Frecache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsadaf2005%2Frecache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsadaf2005%2Frecache/lists"}