3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
44 $key =
"$seq_region_name:$coord_system_id";
46 $array = $seq_region_cache->{$key};
50 $length = $array->[3];
52 # cache miss, get the info from the database
55 # cache the retrieved information
56 $seq_region_cache->{$key} = [
57 $seq_region_id, $seq_region_name,
58 $coord_system_id, $seq_region_length
64 This module is simply a convenient place to put a cache of sequence
65 region information which is shared by several adaptors
for a given
75 package Bio::EnsEMBL::Utils::SeqRegionCache;
77 our $SEQ_REGION_CACHE_SIZE = 40000;
88 # the items to cache should be listrefs to
89 # [ sr_id, sr_name, cs_id, sr_length ]
91 # The name cache key is "sr_name:cs_id"
92 # The id cache is keyed on "sr_id"
95 tie(%name_cache,
'Bio::EnsEMBL::Utils::Cache', $SEQ_REGION_CACHE_SIZE);
96 tie(%id_cache,
'Bio::EnsEMBL::Utils::Cache', $SEQ_REGION_CACHE_SIZE);
98 return bless {
'name_cache' => \%name_cache,
99 'id_cache' => \%id_cache}, $class;