Usage of flat files as datastore and refs as tables in Clojure?
I have built a persistence layer with clojure where database tables are read into refs for the tables and accessed using the Clojure set functions开发者_StackOverflow社区. Would it make sense just to write the data to a flat file, since the refs are all that the Clojure program reads anyway?
That sounds like a great applications of clojures pervasively serializable data structures. and it is in keeping with the primcipal of dont build it if you're not going to need it. keep it simple as long as you can.
You may hit a point where this fails if you have maps of non-clojure-ish data structures that read
and print
cant handle and if you hit that point then start looking at a less simple (only slightly) solution using a real database. A real data base also gives you some protection against loosing data when your program crashes.
Just for the record, maybe the binary serializer used in Datomic, Fressian, would be a good thing to use for this purpose nowadays?
精彩评论