in reply to Selecting one of two implementations
I'm far too new to Perl to know whether there is anything specific to drive you one way or the other, and generally I have worked with much higher level data (like taking spreadsheets and putting them into databases & getting them back again), so my comments should be viewed with this in mind. My experience is that repeating code is fine for throwaway projects, in that it can be far quicker to write for a few specific cases than for all general cases. But I have frequently found code that I thought was going to be thrown away called back into service for something slightly different, and in these situations, I have always found repetitious code to be the greatest evil. You always forget to modify one bit. Since your project sounds very much as though it will not be thrown away, I would advise going for the second approach.
What really scares me is your comment that "growth is possible". If you write the code again in another module, the issue of collisions becomes much more serious, especially if two people end up writing modules at the same time that might cause collisions. Unless your project management guarantees that no more than one programmer can ever write code that reads the cache, you are almost certain to have an unhandled collision. Even if there will only ever be one programmer involved, the "layering" of collision management is likely to be fraught. You have five modules (let's call them the inner modules) at present, but say you write another two. Then another one. This eighth module has to negotiate the collision management of the two outer modules, then the inner modules. At the very least, I'd rather someone else wrote it! Even though new collisions are "not expected" to involve existing data, I wouldn't want to bet my little remaining sanity on it.
The one exception I would make is if you are under time pressure. If you MUST have a solution by $DATE, then get it working as quickly as possible, and get it working WELL later.
All the usual caveats, and probably a few unusual ones as well, should be taken as read.
Regards,
John Davies