diff options
author | mguetlein <martin.guetlein@gmail.com> | 2012-07-27 10:19:50 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2012-07-27 10:19:50 +0200 |
commit | cd8800cf377b5b8c07dc25f3629e503f01bc9112 (patch) | |
tree | eb39c8d58fc7192ceb822bfa5cfd64261230220c /lib | |
parent | 14f49658a0b867b4cc68242804b530548d31097f (diff) |
disable dataset cache when filtering
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dataset_cache.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/dataset_cache.rb b/lib/dataset_cache.rb index 7a13e9b..3f55167 100644 --- a/lib/dataset_cache.rb +++ b/lib/dataset_cache.rb @@ -4,17 +4,21 @@ module Lib module DatasetCache @@cache={} + + def self.disable() + @@cache=nil + end # same as OpenTox::Dataset.find with caching function # rational: datasets are reused in crossvalidation very often, cache to save computational effort # PENDING: may cause memory issues, test with huge datasets def self.find(dataset_uri, subjectid=nil) return nil if (dataset_uri==nil) - d = @@cache[dataset_uri.to_s+"_"+subjectid.to_s] + d = @@cache[dataset_uri.to_s+"_"+subjectid.to_s] if @@cache if d==nil LOGGER.debug "loading dataset #{dataset_uri}" d = OpenTox::Dataset.find(dataset_uri, subjectid) - @@cache[dataset_uri.to_s+"_"+subjectid.to_s] = d + @@cache[dataset_uri.to_s+"_"+subjectid.to_s] = d if @@cache end d end |