source: trunk/essentials/dev-lang/perl/lib/Memoize/Expire.pm@ 3951

Last change on this file since 3951 was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 11.2 KB
Line 
1
2package Memoize::Expire;
3# require 5.00556;
4use Carp;
5$DEBUG = 0;
6$VERSION = '1.00';
7
8# This package will implement expiration by prepending a fixed-length header
9# to the font of the cached data. The format of the header will be:
10# (4-byte number of last-access-time) (For LRU when I implement it)
11# (4-byte expiration time: unsigned seconds-since-unix-epoch)
12# (2-byte number-of-uses-before-expire)
13
14sub _header_fmt () { "N N n" }
15sub _header_size () { length(_header_fmt) }
16
17# Usage: memoize func
18# TIE => [Memoize::Expire, LIFETIME => sec, NUM_USES => n,
19# TIE => [...] ]
20
21BEGIN {
22 eval {require Time::HiRes};
23 unless ($@) {
24 Time::HiRes->import('time');
25 }
26}
27