- @overrides
- def save(self) -> bool:
- if len(self.state) > config.config['arper_min_entries_to_be_valid']:
- logger.debug(
- f'Persisting state to {config.config["arper_cache_location"]}'
- )
- with file_utils.FileWriter(config.config['arper_cache_location']) as wf:
- for (mac, ip) in self.state.items():
- mac = mac.lower()
- print(f'{mac}, {ip}', file=wf)
- return True
- else:
- logger.warning(
- f'Only saw {len(self.state)} entries; needed at least {config.config["arper_min_entries_to_be_valid"]} to bother persisting.'
- )
- return False
-