[code-review] Tie::Hash::Expire
Jeff Yoak <[email protected]> Sun, 01 Feb 2004 17:52:43 -0800
| Newsgroups | gmane.comp.lang.perl.code-review-ladder |
|---|---|
| Message-ID | <[email protected]> |
(This is a second transmission of this message with a different subject. Another poster suggested to me that perhaps it isn't the best idea to mimic a common virus / worm. ;-) I'm sorry for those of you who will see it twice.) Hi all, I just became aware of this list a few minutes ago. What a great idea! Yesterday I uploaded the first version of my first CPAN module, Tie::Hash::Expire, a package providing hash keys that expire and cease to exist after a user-set period. I would be much obliged if anyone here would take a look. As I'm new to distribution through CPAN, I'd particularly appreciate any comments about how I might have messed up there. If the distribution looks non-standard in some way, doesn't work with your CPAN shell, or is in some other way funny, it is probably my oversight / error rather than intentional, so I would prefer to hear about anything like that. Also, if anyone is motivated to really dig into this a little, I'd very much appreciate comments on the internal data architecture. When I originally wrote this, I implemented the data as a normal hash with values of an array reference containing a timestamp and the value for each key. This is enormously simpler than what I ended up doing. I made the switch because I felt that being able to eliminate expired keys through a binary search might represent substantial savings. I'm not any longer sure that I I'm gaining more than I'm spending. One advantage to this approach is that FIRST/NEXTKEY return the keys in order of insertion / modification. I haven't documented this feature as I'm still a little in the air about whether I should retain the implementation that coincidentally makes that possible. Cheers, Jeff