From 98ab033cd47cda9f3f945fb85cabb45a42e6ba14 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 10 May 2012 20:56:42 +0000 Subject: [PATCH] Have Table.pm force flush of more than 5 seconds old, in preparation for more aggresive cache retention git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12612 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Table.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index b0da6cffa..c3017d0e9 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -3050,6 +3050,9 @@ sub getAllAttribs my @attribs = @_; my @results = (); if ($self->{_use_cache}) { + if ($self->{_cachestamp} < (time()-5)) { #NEVER use a cache older than 5 seconds + $self->_refresh_cache(); + } my @results; my $cacheline; CACHELINE: foreach $cacheline (@{$self->{_tablecache}}) { @@ -3276,6 +3279,9 @@ sub getAttribs } my @return; if ($self->{_use_cache}) { + if ($self->{_cachestamp} < (time()-5)) { #NEVER use a cache older than 5 seconds + $self->_refresh_cache(); + } my @results; my $cacheline; if (scalar(keys %keypairs) == 1 and $keypairs{node}) { #99.9% of queries look like this, optimized case