{"id":15330478,"url":"https://github.com/kezhuw/treedb","last_synced_at":"2026-02-02T21:43:54.019Z","repository":{"id":41416687,"uuid":"55160310","full_name":"kezhuw/treedb","owner":"kezhuw","description":"Cache path sensitive hierarchical data storage system","archived":false,"fork":false,"pushed_at":"2019-06-17T14:13:40.000Z","size":52,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-09T10:16:10.535Z","etag":null,"topics":["database","go","nosql","treedb"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/kezhuw.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":"2016-03-31T15:13:18.000Z","updated_at":"2023-10-13T00:46:37.000Z","dependencies_parsed_at":"2022-08-28T13:20:23.749Z","dependency_job_id":null,"html_url":"https://github.com/kezhuw/treedb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kezhuw/treedb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhuw%2Ftreedb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhuw%2Ftreedb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhuw%2Ftreedb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhuw%2Ftreedb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kezhuw","download_url":"https://codeload.github.com/kezhuw/treedb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kezhuw%2Ftreedb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29021031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T18:51:31.335Z","status":"ssl_error","status_checked_at":"2026-02-02T18:49:20.777Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["database","go","nosql","treedb"],"created_at":"2024-10-01T09:53:25.151Z","updated_at":"2026-02-02T21:43:54.001Z","avatar_url":"https://github.com/kezhuw.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TreeDB\nTreeDB is a cache path sensitive hierarchical data store, used as NoSQL database.\n\n**TreeDB is in early stage of development, none parts should be considered as stable. Use it with your own caution!**\n\n## Why another database ?\nDatabase is a facility that provides both memory cache and disk storage, I concludes to this after\nyears development in game server scenarios. What hit me often is memory cache.\n\nThe primary reason to use memory cache is performance. Today, performance promotion benefits from\nscenario insensitive cache used in disk oriented databases is far behind requirement. Memory cache\nsystems are adopted to alleviate database load. Hence boilerplates exists in many projects to handle\nthe similar situations: cache missings, cache loadings, cache consistence, and data writebacks.\nFull memory databases, such as Redis, suffers from other problems: costs and capacities.\n\nThings complicates things. The origin problem is that cache policy used by disk oriented databases\nresults in little performance promotion. Why not give some hits to cache facility? This leads me to\ncreate TreeDB.\n\n## First look\nData stored in TreeDB are structed as hierachical tree structure. Data are accessed through path, similar\nto the filesystem one. Here is the demonstration using `treedb` Go package.\n\n```go\n// Open database, if missing, clone it from database \"template0\".\ndb, err := treedb.Open(\"tcp://:3456\", \"test\", \u0026treedb.Options{TemplateDB: \"template0\", CreateIfMissing: true})\n\n// Set cache pattern for all keys under tree \"/game/users/\".\n// You can set cache patterns in template database.\ndb.Cache(\"/game/users/*\", time.Minute * 30)\n\n// Match previous cache pattern, the path \"/game/users/10023\" will be cached in memory\n// as a whole for about 30 minutes.\nuserData, err := db.Get(\"/game/users/10023\", treedb.FieldTree)\n\n// No cache pattern matched, the path \"/game/modules/arena\" may not cached in memory based on other configs.\ndb.Get(\"/game/modules/arena\", treedb.FieldBinary)\n\n// Modify data.\ndb.Set(\"/game/users/10023/items/20003\", binaryData)\ndb.Delete(\"/game/users/100034/items/20345\")\n\n// Update path's last access timestamp if in memory.\ndb.Touch(\"/game/users/10023\")\n\n// Delete the whole path, whether it is binary or tree.\ndb.Delete(\"/game/users/10023\")\n\n// Create whole tree at path.\nvar userData map[string]interface{}\ndb.Set(\"/game/users/10234\", userData)\n```\n\n## Repository layout\nThe layout of this repository is divided to four parts:\n- Server daemon `treedbd` locates in [cmd/treedbd](cmd/treedbd) directory.\n- Command line tool `treedb` locates in [cmd/treedb](cmd/treedb) directory.\n- Client-Server protocol locates in [protocol](protocol) directory, demonstrated as Go package.\n- Go package as client interface to server is located in the top directory.\n\n## TODO\n- [ ] Customized leveldb to collect orphan tree in merging time\n- [ ] Replication\n    - [ ] Customized leveldb to store WAL for synchronization\n\n## License\nThe MIT License (MIT). See [LICENSE](LICENSE) for the full license text.\n\n## Contribution\nIssues and pull requests are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkezhuw%2Ftreedb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkezhuw%2Ftreedb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkezhuw%2Ftreedb/lists"}