1

img-save.pl:

* fix download condition
* when getting memcached keys we use  only first  slab in list, now all slabs
  are used, so we get full list of keys
This commit is contained in:
eleksir
2018-03-17 23:23:31 +03:00
parent f9654faee0
commit 229d05b801

View File

@@ -69,32 +69,40 @@ while ( 1 ) {
if (defined($itemref->{'hosts'}->{'127.0.0.1:11211'}->{'items'}) if (defined($itemref->{'hosts'}->{'127.0.0.1:11211'}->{'items'})
and (length($itemref->{'hosts'}->{'127.0.0.1:11211'}->{'items'}) > 2)) { and (length($itemref->{'hosts'}->{'127.0.0.1:11211'}->{'items'}) > 2)) {
my $slabinfo = (split("\n", $itemref->{'hosts'}->{'127.0.0.1:11211'}->{'items'}))[0]; foreach my $stat (split("\n", $itemref->{'hosts'}->{'127.0.0.1:11211'}->{'items'})) {
my $slab = (split(/\:/, $slabinfo))[1]; my $slab;
my $itemsamount = (split(/ /, $slabinfo))[2]; my $itemsamount;
my $cachedump = $memd->stats(["cachedump $slab $itemsamount"]);
if ($stat =~ /^STAT items\:(\d+)\:number (\d+)/) {
$slab = $1;
$itemsamount = $2;
} else {
undef $slab;
undef $itemsamount;
next;
}
my $cachedump = $memd->stats(["cachedump $slab $itemsamount"]);
my @keys = map { my @keys = map {
(split(/ /))[1]; (split(/ /))[1];
} split(/\n/, $cachedump->{'hosts'}->{'127.0.0.1:11211'}->{"cachedump $slab $itemsamount"}); } split(/\n/, $cachedump->{'hosts'}->{'127.0.0.1:11211'}->{"cachedump $slab $itemsamount"});
foreach my $key (@keys) { foreach my $key (@keys) {
next unless ($key =~ /^irssi_/); if (($key =~ /^irssi_/) or ($key =~ /^xchtlink_/)) {
next unless ($key =~ /^xchtlink_/);
my $url = $memd->get($key); my $url = $memd->get($key);
cdlfunc($url); cdlfunc($url);
undef $url; undef $url;
$memd->delete($key); $memd->delete($key);
} }
}
undef $slabinfo;
undef $slab; undef $slab;
undef $itemsamount; undef $itemsamount;
undef $cachedump; undef $cachedump;
@keys = -1; @keys = -1;
undef @keys; undef @keys;
} }
}
undef $itemref; undef $itemref;
$memd->disconnect_all; $memd->disconnect_all;