{"id":26152763,"url":"https://github.com/mrinalxdev/redic","last_synced_at":"2026-04-25T09:06:24.253Z","repository":{"id":273879931,"uuid":"918675958","full_name":"mrinalxdev/RediC","owner":"mrinalxdev","description":"Micro implementation of redis in C","archived":false,"fork":false,"pushed_at":"2025-01-23T13:38:20.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T14:30:09.716Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","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/mrinalxdev.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-01-18T15:10:07.000Z","updated_at":"2025-01-23T13:38:23.000Z","dependencies_parsed_at":"2025-01-23T14:40:13.608Z","dependency_job_id":null,"html_url":"https://github.com/mrinalxdev/RediC","commit_stats":null,"previous_names":["mrinalxdev/redic"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrinalxdev%2FRediC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrinalxdev%2FRediC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrinalxdev%2FRediC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrinalxdev%2FRediC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrinalxdev","download_url":"https://codeload.github.com/mrinalxdev/RediC/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242989055,"owners_count":20217693,"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":"2025-03-11T07:21:06.646Z","updated_at":"2026-04-25T09:06:24.211Z","avatar_url":"https://github.com/mrinalxdev.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redis Implementation in C\n\nA lightweight implementation of Redis server from scratch in C, featuring basic data structures and persistence mechanisms similar to Redis.\n\n## Features\n\n### Implemented\n- Basic Key-Value Operations (SET/GET)\n- Data Structures\n  - Lists (PUSH/POP operations)\n  - Sets (SADD/SISMEMBER operations)\n  - Hashes (Hash operations)\n- Persistence\n  - RDB Snapshots (Periodic saving of dataset to disk)\n  - Manual SAVE command\n- Network Communication\n  - TCP/IP server implementation\n  - Basic RESP protocol support\n  - Multiple client connections using select()\n\n### Planned Features\n- AOF (Append Only File) persistence\n- Multi-threading support\n- Advanced RESP protocol features\n- Command pipelining\n- Make file implementation\n\n## Technical Details\n\n### Data Structures\n- Hash table implementation for key-value storage\n- Linked list implementation for List operations\n- Set implementation with duplicate prevention\n- Hash map implementation for complex key-value pairs\n\n### Persistence\n- RDB file format for snapshot storage\n- Automatic periodic saving (every 5 minutes)\n- Manual saving through SAVE command\n\n## Building and Running\n\n### Prerequisites\n- GCC compiler\n- Unix-like operating system (Linux/MacOS)\n\n### Compilation\n```bash\ngcc -o redis-server main.c data_s.c storage.c utils.c rdb.c\n```\n\n### Running the Server\n```bash\n./redis-server\n```\nThe server will start listening on port 6379 (default Redis port)\n\n## Usage\n\n### Connecting to the Server\nYou can use any Redis client or netcat:\n```bash\nnc localhost 6379\n```\n\n### Supported Commands\n\n#### Basic Operations\n```\nSET key value\nGET key\n```\n\n#### List Operations\n```\nPUSH key value\nPOP key\n```\n\n#### Set Operations\n```\nSADD key value\nSISMEMBER key value\n```\n\n#### Persistence Operations\n```\nSAVE\n```\n\n### Examples\n```\nSET user1 \"John Doe\"\nGET user1\nPUSH mylist \"first item\"\nPUSH mylist \"second item\"\nPOP mylist\nSADD myset \"unique value\"\nSISMEMBER myset \"unique value\"\nSAVE\n```\n\n## Project Structure\n\n- `main.c`: Server implementation and command handling\n- `data_s.c/h`: Data structure implementations\n- `storage.c/h`: Basic storage operations\n- `utils.c/h`: Utility functions\n- `rdb.c/h`: RDB persistence implementation\n\n## Implementation Details\n\n### Hash Table\n- Fixed size hash table (256 buckets)\n- Simple hash function based on first character\n- Collision handling through chaining\n\n### Network Protocol\n- Basic implementation of RESP (Redis Serialization Protocol)\n- Support for simple string responses\n- Error handling for unknown commands\n\n### Persistence\n- Binary format for RDB files\n- Version tracking for compatibility\n- Automatic periodic saves\n- Manual save command support\n\n## Memory Management\n\nThe implementation uses dynamic memory allocation for:\n- Storing key-value pairs\n- List nodes\n- Set elements\n- Hash table entries\n\nMemory is freed appropriately when:\n- Items are removed from data structures\n- Connections are closed\n- Server is shut down\n\n## Limitations\n\n- Fixed hash table size\n- Basic hash function implementation\n- No expiration mechanism\n- Limited RESP protocol support\n- No replication support\n- No cluster support\n- No transaction support\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrinalxdev%2Fredic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrinalxdev%2Fredic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrinalxdev%2Fredic/lists"}