X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=src%2FStoreCache.cc;h=99dec06be54e0eda35fc37c844b04ef7d776c11a;hb=36db98966cfc73303c75879811cdedb472d71a4a;hp=b444f32f90f7ed41228a24dc86fa26f1978d387b;hpb=3d2ca40bf3d475f7e2d7e67bd888bd33a94ca978;p=lib1wire.git diff --git a/src/StoreCache.cc b/src/StoreCache.cc index b444f32..99dec06 100644 --- a/src/StoreCache.cc +++ b/src/StoreCache.cc @@ -186,7 +186,11 @@ DataRange *StoreCache::get_mean(EnumSummaryPeriod period_type_param) { store = new StoreDay(device_id, date); ret_val = store->get_mean(period_type_param); - save(fname, ret_val, 4); + if ((period_type_param != PERIOD_MINUTELY) || + (period_type_param != PERIOD_SECONDLY)) { + // no need cache second or minute data + save(fname, ret_val, 4); + } delete(store); } break; @@ -295,7 +299,11 @@ DataRange *StoreCache::get_sum(EnumSummaryPeriod period_type_param) { case PERIOD_SECONDLY: store = new StoreDay(device_id, date); ret_val = store->get_sum(period_type_param); - save(fname, ret_val, 4); + if ((period_type_param != PERIOD_MINUTELY) || + (period_type_param != PERIOD_SECONDLY)) { + // no need cache second or minute data + save(fname, ret_val, 4); + } delete(store); break; } @@ -418,7 +426,11 @@ DataRange *StoreCache::get_delta(EnumSummaryPeriod period_type_param) { case PERIOD_SECONDLY: store = new StoreDay(device_id, date); ret_val = store->get_delta(period_type_param); - save(fname, ret_val, 4); + if ((period_type_param != PERIOD_MINUTELY) || + (period_type_param != PERIOD_SECONDLY)) { + // no need cache second or minute data + save(fname, ret_val, 4); + } delete(store); break; } @@ -536,7 +548,11 @@ DataRange *StoreCache::get_max(EnumSummaryPeriod period_type_param) { case PERIOD_SECONDLY: store = new StoreDay(device_id, date); ret_val = store->get_max(period_type_param); - save(fname, ret_val, 4); + if ((period_type_param != PERIOD_MINUTELY) || + (period_type_param != PERIOD_SECONDLY)) { + // no need cache second or minute data + save(fname, ret_val, 4); + } delete(store); break; } @@ -654,7 +670,11 @@ DataRange *StoreCache::get_min(EnumSummaryPeriod period_type_param) { case PERIOD_SECONDLY: store = new StoreDay(device_id, date); ret_val = store->get_min(period_type_param); - save(fname, ret_val, 4); + if ((period_type_param != PERIOD_MINUTELY) || + (period_type_param != PERIOD_SECONDLY)) { + // no need cache second or minute data + save(fname, ret_val, 4); + } delete(store); break; }