clear method
Clears all items from the cache using the default driver.
This operation removes all cached data and cannot be undone.
Throws CacheException if the operation fails.
Implementation
@override
Future<void> clear() async {
try {
final driver = _driverRegistry.getDefaultDriver();
await driver.clear();
_statisticsManager.updateStats(
_driverRegistry.getDefaultDriverName(),
hit: false,
operation: 'clear',
);
// Clear all tags
_tagManager.clearAllTags();
} catch (e) {
_statisticsManager.updateStats(
_driverRegistry.getDefaultDriverName(),
hit: false,
operation: 'clear',
error: true,
);
throw CacheException('Failed to clear cache: $e');
}
}