{"id":15646321,"url":"https://github.com/lsk569937453/rcache","last_synced_at":"2025-08-22T05:30:50.203Z","repository":{"id":231228523,"uuid":"778200880","full_name":"lsk569937453/rcache","owner":"lsk569937453","description":"Rcache 是基于rust实现的redis解决方案。","archived":false,"fork":false,"pushed_at":"2024-07-16T02:48:09.000Z","size":86,"stargazers_count":49,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-10T03:40:32.997Z","etag":null,"topics":["cache","redis","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lsk569937453.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-03-27T09:19:47.000Z","updated_at":"2024-09-27T06:16:47.000Z","dependencies_parsed_at":"2024-05-08T04:25:05.043Z","dependency_job_id":"d5f99315-eccc-4df5-94e9-33f0114d06ea","html_url":"https://github.com/lsk569937453/rcache","commit_stats":null,"previous_names":["lsk569937453/rcache"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsk569937453%2Frcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsk569937453%2Frcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsk569937453%2Frcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsk569937453%2Frcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsk569937453","download_url":"https://codeload.github.com/lsk569937453/rcache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230561013,"owners_count":18245324,"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":["cache","redis","rust"],"created_at":"2024-10-03T12:12:25.533Z","updated_at":"2024-12-20T09:06:11.438Z","avatar_url":"https://github.com/lsk569937453.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rcache\nRcache是基于rust实现的redis缓存。该项目是一个demo工程，主要演示了如何使用rust实现redis的核心模块。\n\n# 支持的指令\n- set\n- get\n- append\n- decr\n- getdel\n- getrange\n- getset\n- incr\n- incrby\n- incrbyfloat\n- lcs\n- mget\n- mset\n- msetnx\n- lpush\n- rpush\n- lpop\n- rpop\n- sadd\n- hset\n- zadd\n- lrange\n# rdb持久化时间统计\n\n```\nrcache           | Rdb file has been saved,keys count is 19623,encode time cost 60ms,total time cost 60ms\nrcache           | Rdb file has been saved,keys count is 227031,encode time cost 683ms,total time cost 683ms\nrcache           | Rdb file has been saved,keys count is 436068,encode time cost 1322ms,total time cost 1322ms\nrcache           | Rdb file has been saved,keys count is 642909,encode time cost 1951ms,total time cost 1951ms\nrcache           | Rdb file has been saved,keys count is 849693,encode time cost 2579ms,total time cost 2579ms\nrcache           | Rdb file has been saved,keys count is 1053635,encode time cost 3319ms,total time cost 3319ms\nrcache           | Rdb file has been saved,keys count is 1256806,encode time cost 3946ms,total time cost 3946ms\nrcache           | Rdb file has been saved,keys count is 1460143,encode time cost 4439ms,total time cost 4439ms\nrcache           | Rdb file has been saved,keys count is 1662464,encode time cost 5153ms,total time cost 5153ms\nrcache           | Rdb file has been saved,keys count is 1849100,encode time cost 6048ms,total time cost 6048ms\nrcache           | Rdb file has been saved,keys count is 2045408,encode time cost 6958ms,total time cost 6958ms\nrcache           | Rdb file has been saved,keys count is 2235381,encode time cost 7189ms,total time cost 7189ms\nrcache           | Rdb file has been saved,keys count is 2431964,encode time cost 7577ms,total time cost 7577ms\nrcache           | Rdb file has been saved,keys count is 2629802,encode time cost 8172ms,total time cost 8172ms\nrcache           | Rdb file has been saved,keys count is 2827623,encode time cost 8854ms,total time cost 8854ms\nrcache           | Rdb file has been saved,keys count is 3023288,encode time cost 9540ms,total time cost 9540ms\nrcache           | Rdb file has been saved,keys count is 3216428,encode time cost 10372ms,total time cost 10372ms\nrcache           | Rdb file has been saved,keys count is 3409558,encode time cost 6106ms,total time cost 6106ms\nrcache           | Rdb file has been saved,keys count is 3519240,encode time cost 10828ms,total time cost 10828ms\n```\n可以看出rdb的时间随着key的多少而不同，300w个key的持久化时间大概在9s左右。\n# 压测结果\n通过redis-benchmark对rcache和redis进行性能对比(4核心8G内存)测试，结果如下:\n![alt tag](https://raw.githubusercontent.com/lsk569937453/image_repo/main/rcache/c.png)\n\n总共做了三组对比实验:\n\n- redis:原生 redis\n- rcache(mpsc 的 channel 版本):rcache 的 1.0 实现，代码位于tag 0.0.1版本\n- rcache(全局 mutex 版本):rcache 参考 mini-redis 实现,性能和 mini-redis 一样，代码位于主分支代码\n\n实验结果\nrcache 基于 mini-redis 的实现，性能等于 mini-redis。相比原生的 redis ，单线程吞吐量是 redis 的 90%，多线程的吞吐量是原生的 redis 的两倍。\n\n# 架构\n参考 mini-redis,直接用 Mutex 对全局的数据加锁,全局的 struct 内部其实就是用多个 HashMap 来存储 string,list,hash 以及过期 map 等数据结构。没想到效果出奇的好。\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsk569937453%2Frcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsk569937453%2Frcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsk569937453%2Frcache/lists"}