--
You received this message because you are subscribed to the Google Groups "Perl-Cache Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to perl-cache-disc...@googlegroups.com.
To post to this group, send email to perl-cach...@googlegroups.com.
Visit this group at https://groups.google.com/group/perl-cache-discuss.
For more options, visit https://groups.google.com/d/optout.
Just traverse the cache file hierarchy and remove files based on their last modification date. You can do this with Unix find or File::Find.
It is still far less efficient than simply looking at the file modification time - you have to open each file and convert it to a cache entry. But if it works for you, great! I’d still keep the warning.Thanks
Jon
On Sep 23, 2016, at 5:10 AM, Peter V. Mørch <p...@capmon.dk> wrote:
On Friday, September 23, 2016 at 7:08:39 AM UTC+2, Jonathan Swartz wrote:Just traverse the cache file hierarchy and remove files based on their last modification date. You can do this with Unix find or File::Find.
I can see from the base-class implementation of CHI::Driver::purge(), that it calls $self->get_keys and removes those where $obj->is_expired.
CHI::Driver::File::get_keys uses File::Find. $fileCache->purge() has the added advantage over raw/simple File::Find that it also handles specific values of $expires_in given to $cache->set($key, $data, $expires_in), which a raw File::Find would't be able to handle.
I can also see that e.g. CHI::Driver::Memcached::Base has:
__PACKAGE__->declare_unsupported_methods(
qw(dump_as_hash get_keys get_namespaces is_empty clear purge));
So it seems that purge() isn't actually so inefficient after all. Since these two cases are my use cases for now, what I'm doing now is:
eval {
$cache->purge();
};
if (my $err = $@) {
if ($err !~ /^method 'purge' not supported/) {
die $err;
}
}
But it would be nice to remove the warning in the documentation about inefficiency, since the code is as efficient as possible. And document that purge throws an exception in pathalogical cases such as memcached.
So for now I can scratch my own itch - using a method documented as inefficient,but which in reality is either ok or throws an exception.--
You received this message because you are subscribed to the Google Groups "Perl-Cache Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to perl-cache-discuss+unsub...@googlegroups.com.
To post to this group, send email to perl-cache-discuss@googlegroups.com.
Visit this group at https://groups.google.com/group/perl-cache-discuss.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Perl-Cache Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/perl-cache-discuss/6pATPgkySAM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to perl-cache-discuss+unsub...@googlegroups.com.
To post to this group, send email to perl-cache-discuss@googlegroups.com.
Visit this group at https://groups.google.com/group/perl-cache-discuss.
For more options, visit https://groups.google.com/d/optout.
Jon
To unsubscribe from this group and stop receiving emails from it, send an email to perl-cache-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to perl-cache-discuss@googlegroups.com.
Visit this group at https://groups.google.com/group/perl-cache-discuss.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Perl-Cache Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/perl-cache-discuss/6pATPgkySAM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to perl-cache-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to perl-cache-discuss@googlegroups.com.
Visit this group at https://groups.google.com/group/perl-cache-discuss.
For more options, visit https://groups.google.com/d/optout.
--Peter Valdemar Mørch
Udviklingchef
Mobil: +45 4062 6296
CapMon A/S
Lyskær 9, 1.th., 2730 Herlev
Web: www.capmon.dk
--
Will do!
--
You received this message because you are subscribed to the Google Groups "Perl-Cache Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to perl-cache-discuss+unsub...@googlegroups.com.
To post to this group, send email to perl-cache-discuss@googlegroups.com.
Please replace with this:
if ( my $sub = $cache->can('purge') ) { $cache->$sub }