in reply to Saving MySQL Queries in an XML format
Morever you could use Cache::Cache to handle caching. This module provides quite high level API for data cache (and AFAIK it uses Storable to serialize/deserialize data).
I've rewrote you example using Cache::Cache:
# init cache object at the begining of the program my $CACHE = new Cache::FileCache( ); ..... ..... #### Cut, subroutine from module foreach my $tid (@completed){ $results{$tid} = $CACHE->get($tid); unless(defined $results{$tid}) { $results{$tid} = $self->Complex_Crap($tid); # data will expire in cache in 10 minutes $CACHE->set($tid => $results{$tid}, "10 minutes"); } } $self->Results(\%results); return($self); }
Update: Added example of Cache::Cache usage.
--
Ilya Martynov
(http://martynov.org/)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re: Saving MySQL Queries in an XML format
by merlyn (Sage) on Jul 05, 2002 at 15:34 UTC | |
by oakbox (Chaplain) on Jul 05, 2002 at 15:45 UTC |