Commit 60ce277d authored by Matthieu Muffato's avatar Matthieu Muffato
Browse files

Need to clean-up the additional lookups too

parent 8c1afce8
......@@ -85,6 +85,7 @@ sub put {
my ($self, $key, $object) = @_;
my $old = $self->SUPER::put($key, $object);
#Add to additional lookup
$self->remove_from_additional_lookup($key, $old) if $old;
$self->add_to_additional_lookups($key, $object);
return $old if $old;
return;
......
......@@ -119,6 +119,11 @@ sub BEGIN {
dies_ok { $cache->get_by_additional_lookup('biotype', 'protein_coding') } 'Expect to die as the query will return more than one value';
# Add the same gene to the cache and check it's not there twice
$cache->put($individual_gene->dbID(), $individual_gene);
my $same_genes = $cache->get_all_by_additional_lookup('dbID', $gene_ids->[0]);
is(scalar(@$same_genes), 1, 'The gene is still in 1 copy in the lookup');
#Clear the cache and make sure that we can still retrieve by additional values
{
$cache->clear_cache();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment