I am using WWW::Mechanize::Cached together with Cache::FileCache, and I'd like to remove certain URLs from the cache sometimes but WWW::Mechanize::Cached doesn't have such an option.
I've looked through the source code, and can see that the caching is set using this line:
$self->cache->set( $req, freeze( $response ) ) if $should_cache;
So I've tried using the following code to remove an item from the cache:
$cache->remove($mech->response->request) or warn "cannot remove $!";
or
$cache->remove($mech->response->request->as_string) or warn "cannot remove $!";
But I get the warning: "cannot remove No such file or directory".
I've also found the following ideas, but none seem to work https://groups.google.com/forum/?fromgroups#!topic/perl-cache-discuss/M_wXFNL5MdM[1-25]
if ( $want_to_delete_url ) {
$mech->cache->remove( $url );
}
$mech->get( $url );
http://www.perlmonks.org/?node_id=564208
my $url = "http://www.rulez.sk/headers.php";
my $req = GET $url, 'Accept-Encoding' => 'identity';
$cache->remove($req->as_string) or print "cannot remove $!";