Simple, modern, robust, transparent persistence of data structures for Perl

前端 未结 3 2450
囚心锁ツ
囚心锁ツ 2021-02-20 01:52

I\'m looking for a solution to transparently persist Perl data structures (not even objects, but object support would be a plus) without circular references. I don\'t c

3条回答
  •  轮回少年
    2021-02-20 02:37

    I don't think transparent persistence is very good idea. Suppose you have hypothetical implementation that ties perl data structure to outside world. To be transparent, every write into the structure have to be detected and data outside updated. This is probably going to be quite expensive and end with a lot of disk activity unless you have sophisticated backend with fast random access. I cannot imagine updates of JSON file be efficient.

    Some options:

    • use database backend (DBM::Deep, DB_File or KiokuDB)
    • use key-value store as backend (Memcached, Redis)
    • define consistent workflow on data and serialize/deserialize in good moment

提交回复
热议问题