def _simulate_local(self, records, cache_local_mb, f): from relstorage.cache.local_client import LocalClient options = MockOptions() options.cache_local_mb = cache_local_mb options.cache_local_compression = 'none' client = LocalClient(options) now = time.time() for record in records: key = record.lba if record.opcode == 'r': data = client.get(key) if data is None: # Fill it in from the backend client.set(key, b'r' * record.size) else: assert record.opcode == 'w' client.set(key, b'x' * record.size) done = time.time() stats = client.stats() self._report_one(stats, f, cache_local_mb, now, done) return stats