{"id":21423264,"url":"https://github.com/pirate-emperor/gocache","last_synced_at":"2026-01-29T17:32:02.746Z","repository":{"id":263128351,"uuid":"889427912","full_name":"Pirate-Emperor/GoCache","owner":"Pirate-Emperor","description":" GoCache is a lightweight Redis clone in Go, supporting key-value storage, RDB persistence, partial replication, streams, and basic transactions. It provides essential Redis-like functionality with commands like SET, GET, XADD, and MULTI, designed for learning and experimentation.","archived":false,"fork":false,"pushed_at":"2024-11-16T11:16:56.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T05:12:42.675Z","etag":null,"topics":["command-handling","go","golang","key-value-storage","rdb","redis-cache","replication","streams","transactions"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pirate-Emperor.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-16T11:04:59.000Z","updated_at":"2024-11-16T11:54:06.000Z","dependencies_parsed_at":"2024-11-16T12:21:04.354Z","dependency_job_id":"f8b6c4a3-d639-4245-ac0b-9388b1b3061e","html_url":"https://github.com/Pirate-Emperor/GoCache","commit_stats":null,"previous_names":["pirate-emperor/gocache"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Pirate-Emperor/GoCache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pirate-Emperor%2FGoCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pirate-Emperor%2FGoCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pirate-Emperor%2FGoCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pirate-Emperor%2FGoCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pirate-Emperor","download_url":"https://codeload.github.com/Pirate-Emperor/GoCache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pirate-Emperor%2FGoCache/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265262599,"owners_count":23736427,"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":["command-handling","go","golang","key-value-storage","rdb","redis-cache","replication","streams","transactions"],"created_at":"2024-11-22T21:15:25.762Z","updated_at":"2026-01-29T17:32:02.716Z","avatar_url":"https://github.com/Pirate-Emperor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoCache\n\n**GoCache** is a lightweight Redis clone implemented in Go. It provides a simplified yet functional key-value store with support for persistence, basic replication, transactions, and streams.\n\n---\n\n## 🚀 Features\n\n1. **Key/Value Storage**:\n   - `GET` and `SET` commands with support for setting expiry times.\n2. **RDB Persistence**:\n   - Load data from RDB files for persistent storage.\n3. **Replication**:\n   - Partial support for replication with basic master-replica setups.\n4. **Streams**:\n   - `TYPE`, `XADD`, `XREAD`, and `XRANGE` commands for basic stream operations.\n5. **Transactions**:\n   - Commands like `MULTI`, `EXEC`, `DISCARD`, and `INCR` for transactional workflows.\n\n---\n\n## 🛠 Prerequisites\n\n- **Go**: Install the latest version from the [official website](https://go.dev/dl/).\n\n---\n\n## 🔧 Installation\n\nFollow these steps to set up GoCache:\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/Pirate-Emperor/GoCache.git\n   ```\n\n2. Navigate to the project directory:\n   ```bash\n   cd GoCache\n   ```\n\n3. Build the project:\n   ```bash\n   go build -o goredis ./app\n   ```\n\n   The executable `goredis` will be created in the project directory.\n\n---\n\n## 🖥 Usage\n\nStart the GoCache server:\n\n```bash\n./goredis\n```\n\n### ⚙️ Configuration Options\n\n- **Port**:\n  By default, the server binds to port `6379`. Use the `--port` flag to specify a different port:\n  ```bash\n  ./goredis --port 6380\n  ```\n\n- **RDB File**:\n  Load an existing RDB file with the `--dir` (directory) and `--dbfilename` (filename) flags:\n  ```bash\n  ./goredis --dir /tmp/redis-files --dbfilename dump.rdb\n  ```\n  Default: `/tmp/redis-files/dump.rdb`.\n\n- **Replication**:\n  Start the server in replica mode with the `--replicaof` flag:\n  ```bash\n  ./goredis --replicaof \"localhost 6379\"\n  ```\n\n---\n\n## 🛑 Limitations\n\n- **Unsupported Commands**:\n  - Hash operations like `HGET` and `HSET` are not implemented.\n- **Replication**:\n  - Partial replication support; commands like `WAIT` are not yet implemented.\n- **RDB Saving**:\n  - Server can load RDB files but does not support saving with the `SAVE` command.\n- **Basic Feature Set**:\n  - Limited to fundamental Redis-like features for simplicity.\n\n---\n\n## 📋 Supported Commands\n\n### General\n\n- `PING`: Test server connection.\n- `ECHO`: Return the given string.\n\n### Key/Value Operations\n\n- `SET` and `GET`: Basic key-value operations.\n- `INCR`: Increment integer values.\n\n### Transactions\n\n- `MULTI`: Start a transaction.\n- `EXEC`: Execute queued commands in a transaction.\n- `DISCARD`: Discard queued transaction commands.\n\n### Streams\n\n- `TYPE`: Identify the type of a key.\n- `XADD`: Add a new entry to a stream.\n- `XRANGE`: Retrieve entries within an ID range.\n- `XREAD`: Read from streams (supports blocking and non-blocking).\n\n### Configuration and Replication\n\n- `CONFIG`: Get or set server configuration parameters.\n- `INFO`: Display server statistics.\n- `REPLCONF`: Configure replication settings.\n- `PSYNC`: Partial synchronization for replicas.\n\n---\n\n## 🏗 Future Enhancements\n\n- Implement advanced Redis commands, including `HGET`, `HSET`, and `WAIT`.\n- Add support for RDB file saving.\n- Expand replication support for comprehensive master-replica setups.\n\n---\n\n## 📚 Acknowledgments\n\n- **Redis**: For inspiration and documentation.\n- **HDT3213**: For the CRC64 checksum [implementation](https://github.com/HDT3213/rdb/blob/e5a00e130dda889ce1396d5561f95540418d12fc/crc64jones/crc64.go).\n\n---\n\n## 📜 License\n\nThis project is licensed under the **Pirate-Emperor License**. See the [LICENSE](LICENSE) file for details.\n\n---\n\n## 👤 Author\n\n\n**Rahul Kumar Singh**  \n\n[![Twitter](https://skillicons.dev/icons?i=twitter)](https://twitter.com/PirateKingRahul)\n[![Discord](https://skillicons.dev/icons?i=discord)](https://discord.com/users/1200728704981143634)\n[![LinkedIn](https://skillicons.dev/icons?i=linkedin)](https://www.linkedin.com/in/piratekingrahul)\n\n[![Reddit](https://img.shields.io/badge/Reddit-FF5700?style=for-the-badge\u0026logo=reddit\u0026logoColor=white)](https://www.reddit.com/u/PirateKingRahul)\n[![Medium](https://img.shields.io/badge/Medium-42404E?style=for-the-badge\u0026logo=medium\u0026logoColor=white)](https://medium.com/@piratekingrahul)\n\n- 📧 Email: [piratekingrahul@gmail.com](mailto:piratekingrahul@gmail.com)  \n- 📍 Location: Surat, Gujarat, India  \n- 🌐 GitHub: [Rahul Kumar Singh](https://github.com/Pirate-Emperor)\n\n\n---\n\nStart using GoCache today and experience the power of lightweight key-value storage! 🌟","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirate-emperor%2Fgocache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpirate-emperor%2Fgocache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirate-emperor%2Fgocache/lists"}