I have the following requirements:
- The sequence is unique to a host (no shared incrementing is necessary)
- The sequence must be monotonically increasing.
- The sequence must be persistent across processes.
- Incrementing the sequence must be atomic in the case of multiple processes working on it at the same time.
- Most of the time the file will be updated and the new value read after update. But, it should also be possible to read the current value without update.
I can hack together perl code that will do roughly this, but I'd like a more elegant solution.
flock
wrapper count as elegant? – Multilingual