Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Greetings Monks! I have a script that runs often, is run by lots of different processes, and takes a long time. It is basically testing the environment to see if whatever called it can proceed. I should be able to cache the results in some way, but I want to make sure I do the caching properly. There is no "Key" for this cache. All answers are the same. A database is not appropriate, so I need to handle any atomic/concurrency stuff.
This is where it gets more complicated. Do I wait around for whoever has the lock to finish? Do I wait only if the locking process is doing the tests? How do I handle a situation where a locking process has wandered off into oblivion and hasn't released the lock? I'm on linux and I'm thinking with flock, but I'm open to non-flock ideas. In reply to Concurrent Cache Pattern by pileofrogs
|
|