in reply to I need speed...
Warning... untested code.
#!/usr/bin/perl -wT use strict; use DB_File; my $dbmfile = '/tmp/lookuptable'; tie my %lookuptable, "DB_File", $dbmfile, O_RDWR|O_CREAT, 0640, $DB_HA +SH or die "Cannot open file '$dbmfile': $!\n"; # do whatever it is to get the ids... my $id = '123456789'; # check lookup cache: my $cachevalue = $lookuptable{$id}; if ($cachevalue eq 'Y') { # link is ok } elsif ($cachevalue eq 'N') { # link is bad } else { # determine if it is good or bad. my $isok = 'Y'; # add the calculated value to the cache $lookuptable{$id} = $isok }
-Blake
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: I need speed...
by Aristotle (Chancellor) on Oct 07, 2001 at 13:19 UTC | |
by blakem (Monsignor) on Oct 07, 2001 at 13:40 UTC | |
by perrin (Chancellor) on Oct 08, 2001 at 00:27 UTC | |
by Aristotle (Chancellor) on Oct 08, 2001 at 02:51 UTC | |
by perrin (Chancellor) on Oct 08, 2001 at 03:17 UTC |