Ask HN: What internal data structures does redis use to make it so fast?
Also as a learning exercise how do I make a pure disk based redis. e.g the way sqlite is to sql
Also as a learning exercise how do I make a pure disk based redis. e.g the way sqlite is to sql
JSON in binary format? You mean BSON? Just use MongoDB at that point, or PostgreSQL with JSON support. Redis has tables to an extent, you don't need any more than that.
Also, running on disk versus in memory is very different. Writing in SQLite is done to a Write-Ahead Log and then committed into the file slowly. Reads are done by building a schema to a set of pointer additions and finding objects in b-trees by scanning both the in-memory cache as well as objects on the hard drive. Totally, totally different. Just use the Redis Serialization feature instead. Or, better yet, use MongoDB/PostgreSQL/SQLite as intended.
Aside: the whole point of the Structured Query Language is to take away the lowest level, most basic work from the programmer. That way, he or she can write the logic without worrying about how the logic is performed. Why redo all of that work? SQL exists for a reason: so you don't reinvent the wheel.