Skip to content

Commit

Permalink
Make it more perl6-ish
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-vigier committed Jan 19, 2016
1 parent 80b234a commit 70e1966
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/Cache/LRU.pm
Expand Up @@ -45,16 +45,8 @@ class Cache::LRU {
@!fifo.push( ($key, $entry) );

if @!fifo.elems >= $.size * GC_FACTOR {
my %need;
for %!entries.keys -> $k {
%need{$k} = 1;
}
my @new_fifo = gather while (%need.elems) {
my $fifo_entry = @!fifo.shift;
take $fifo_entry
if %need{$fifo_entry.[0]}:delete;
}
@!fifo = @new_fifo;
my %need = %!entries.keys X=> 1;
@!fifo .= grep( { %need{$_.[0]}:delete } );
}
}

Expand Down

0 comments on commit 70e1966

Please sign in to comment.