This is the latest incarnation of a toolkit I first started working on in early 2012, and which I use as a starting point for constructing certain kinds of specialized local-persistence libraries.
It's a problem space where subtle tensions between requirements can have a drastic impact on the shape of the optimal solution, so please keep in mind that I'm publishing this source to share the ideas behind it, not to share a turn-key component that can be dropped into another project.
You're welcome to use the code in any way that's consistent with the (MIT) license, and I'm more than happy to have conversations over issues or pull requests.
Documentation explaining the design goals, and how the pieces fit together, will follow sometime in the future.