You can certainly cache the output of some command with Cache::FileCache.
sub qx_cache { my $cmd = shift; my $cache = Cache::FileCache->new({ namespace => $0 }); die 'no cache' if ! $cache; my $out = $cache->get( $cmd ); if ( ! defined $out ) { $out = qx{ $cmd }; $cache->set( $cmd, $out ); } return $out; }
You can set a timeout value when you call set(). Any get() on a key that's expired will come back undef.
In reply to Re^3: Cache commands output
by kyle
in thread Cache commands output
by wangcong
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |