def memorise(self, ts): ''' Save timeserie into cacje and save itself ''' if ts: st = todate(ts.front()[0]) ed = todate(ts.back()[0]) self.start[ts.name] = st self.end[ts.name] = ed tslist = [(todate(d), v) for d, v in ts.items()] self.backend.set(ts.name, tslist, settings.RATE_CACHE_SECONDS) self.save() self.logger.debug('Cached %s from %s to %s' % (ts.name, st, ed)) else: self.start = None self.end = None
def memorise(self, ts): ''' Save timeserie into cacje and save itself ''' if ts: st = todate(ts.front()[0]) ed = todate(ts.back()[0]) self.start[ts.name] = st self.end[ts.name] = ed tslist = [(todate(d),v) for d,v in ts.items()] self.backend.set(ts.name,tslist,settings.RATE_CACHE_SECONDS) self.save() self.logger.debug('Cached %s from %s to %s' % (ts.name,st,ed)) else: self.start = None self.end = None
def timeseries(self, vfid): ''' @param vfid: vendor field id @see: jflow.core.rates.factory.factory.vendorfieldid ''' key = self.tsname(vfid) nts = self._timeseries.get(key, None) if nts == None: fts = self.backend.get(key, []) if vfid.numeric: nts = numericts(key) else: nts = dateseries(key) for d, v in fts: nts[todate(d)] = v self._timeseries[key] = nts return nts
def timeseries(self, vfid): ''' @param vfid: vendor field id @see: jflow.core.rates.factory.factory.vendorfieldid ''' key = self.tsname(vfid) nts = self._timeseries.get(key,None) if nts == None: fts = self.backend.get(key,[]) if vfid.numeric: nts = numericts(key) else: nts = dateseries(key) for d,v in fts: nts[todate(d)] = v self._timeseries[key] = nts return nts