Find the answer to your Linux question:
Results 1 to 2 of 2
Does anyone know how multi-process safe the Perl dbm databases are? (I guess genlee will be the one to answer this...) If I didn't make myself clear enough, my intention ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578

    Perl dbm


    Does anyone know how multi-process safe the Perl dbm databases are? (I guess genlee will be the one to answer this...)
    If I didn't make myself clear enough, my intention is to have the same dbm database opened by several perl processes, and I want to make sure mainly two things: that no perl process caches any data locally, and that I don't take any risks by letting processes write arbitrary records without locking the file.

  2. #2
    Linux Engineer
    Join Date
    Jan 2003
    Location
    Lebanon, pa
    Posts
    994
    Perl has its own lock function which calls flock() to do file locking (perldoc -q lock for more info). Check out a module calle DB_File which I think would be good for this. It can do locking, insert, update, delete and can create an index. I also believe GDBM has built in locking as well but I have never used it. I normally store everything in mysql if I need a database. As of right now, I am not sure how you would clear the read cache without closing then opening the db again. I'll check around and let you know if I find anything.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •