(Dan) wrote:
> Do I have to use a file lock algorithm wrapped around when I am just
> goint to READ from the file?
>
> Will file corruption over time be a problem? (the script will be
> running on a heavy load website, multiple processes, maybe sometimes
> to read all at once)
>
> As I udnerstand it I'll have to lock the DB_File only for
> write/read-write access, but for reading only??
[this applies much more generally than tied hashes]
If anyone is going to be writing, then *everyone* has to lock. Readers
lock with LOCK_SH, writers with LOCK_EX. See the documentation for
DB_File for some important caveats when locking. If you have control
of every program accessing this database, it is probably a better idea
to use a lockfile: lock the file before you tie, and untie before you
unlock.
Ben
--
I've seen things you people wouldn't believe: attack ships on fire off the
shoulder of Orion; I've watched C-beams glitter in the darkness near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die. |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-|