looking for light-weight data persistence solution in perl

后端 未结 6 1473
离开以前
离开以前 2021-02-14 11:29

In my app I need to store some simple data both in memroy and in disk. A real database will be overkill in my case, so I need lighter one to handle the simple data persistence r

6条回答
  •  你的背包
    2021-02-14 12:17

    If I had to do this I would probably go with DBI and DBD::SQLite, since it does not involve reading all the data into memory, but I'd just like to mention a few other ways, because "there's more than one way to do it":

    The old way to do this was with DB_file and its cousins. It still works with modern versions of Perl. The drawback is that it are only useful for storing a one-dimensional hash (a hash which doesn't have any references in it). The advantage is that you can find nice books about it which don't cost very much money, and also online articles, and also I believe it doesn't involve reading the whole file into memory.

    Another method is to print the contents of Data::Dumper to a file to store, and eval the contents of the file to read the data.

    Yet another thing which hasn't been mentioned is KiokuDB, which looks like the cutting-edge Moose-based module, if you want to be trendy.

提交回复
热议问题