Flock to Rename Directoryby virtualweb (Sexton)
|on Sep 17, 2009 at 16:08 UTC||Need Help??|
virtualweb has asked for the
wisdom of the Perl Monks concerning the following question:
Im a novice and many times I come up with alternatives that are not always the wisest way to go about something..
I need advise regarding how to save some info that needs to be retrieved and changed often, (every 20 seconds or so), and dont want to used MySQL or any other database requering Structured query language.
If I save each record in a single Flat File, it would need to be opened, read, and rewritten, which I assume is not the fastest technique.. If I save all records in a single flat file, (one record per line), reading the whole file into memory every 20 seconds and change what's needed may not be the best way to go either, knowing there could be 15.000 lines or more... so I thought perhaps I could save each record in a different directory name.
I need to save name, username, time, and two other numerical parameters, so I would call my directory:
Then split the directory name into array values and change what's needed, 20 seconds later the name of the directory could look like this:
Is the above method a feasible solution..??
What would happen if more than one need to change the directory name at the same time. I know that in a flat file system you can lock the file with flock and change the data without worries, but what is used in the case of directory names..??
Thanx for your input
Thanx for all the input
The reason why I was trying to come up with an alternative to a proper database is because i dont know how to install one in my Windows PC environment.
I have read query language tutorials and is, (as you pointed out), very easy but dont know how do I install the simplest database, how do I test my scripts locally, how to move it to the server for final installation.
Since I discarded the idea of renaming directories, I continue this conversation on node Query Language with Flat Files