def flush(self): CachedDOData.flush(self) self._flushed = True
def __init__(self): CachedDOData.__init__(self) self._destroyed = False self._flushed = False
def destroy(self): CachedDOData.destroy(self) self._destroyed = True
CachedDOData.__init__(self) self._destroyed = False self._flushed = False def destroy(self): CachedDOData.destroy(self) self._destroyed = True def flush(self): CachedDOData.flush(self) self._flushed = True dc = CRDataCache() dc._startMemLeakCheck() cd = CachedDOData() cd.foo = 34 dc.setCachedData(1, 'testCachedData', cd) del cd cd = CachedDOData() cd.bar = 45 dc.setCachedData(1, 'testCachedData2', cd) del cd assert dc.hasCachedData(1) assert dc.hasCachedData(1) assert not dc.hasCachedData(2) # data is dict of dataName->data data = dc.popCachedData(1) assert len(data) == 2 assert 'testCachedData' in data assert 'testCachedData2' in data
class TestCachedData(CachedDOData): def __init__(self): CachedDOData.__init__(self) self._destroyed = False self._flushed = False def destroy(self): CachedDOData.destroy(self) self._destroyed = True def flush(self): CachedDOData.flush(self) self._flushed = True dc = CRDataCache() dc._startMemLeakCheck() cd = CachedDOData() cd.foo = 34 dc.setCachedData(1, 'testCachedData', cd) del cd cd = CachedDOData() cd.bar = 45 dc.setCachedData(1, 'testCachedData2', cd) del cd assert dc.hasCachedData(1) assert dc.hasCachedData(1) assert not dc.hasCachedData(2) # data is dict of dataName->data data = dc.popCachedData(1) assert len(data) == 2 assert 'testCachedData' in data assert 'testCachedData2' in data