<s> from chatto_transform . datastores . datastore_base import DataStore <EOL> class CachingDataStore ( DataStore ) : <EOL> def __init__ ( self , schema , load_ds , cache_ds ) : <EOL> super ( ) . __init__ ( schema ) <EOL> self . load_ds = load_ds <EOL> self . cache_ds = cache_ds <EOL> def _load ( self ) : <EOL> if self . cache_ds . exists ( ) : <EOL> return self . cache_ds . load ( ) <EOL> df = self . load_ds . load ( ) <EOL> try : <EOL> self . cache_ds . store ( df ) <EOL> except ValueError : <EOL> return df <EOL> return df <EOL> def update_cache ( self ) : <EOL> df = self . load_ds . load ( ) <EOL> try : <EOL> self . cache_ds . store ( df ) <EOL> except ValueError : <EOL> return df <EOL> return df </s>
