-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Labels
Description
Feature Request
User Story
As a Flutter developer using NDK
I want to clear all cached data with a single method call
So that I can easily provide a "Clear cache" button to users without
needing to know the internal structure of the cache
Acceptance Criteria
- Add a
clearAll()method to theCacheManagerabstract class - The method should clear all cached data (events, user relay lists, relay
sets, contact lists, metadatas, nip05s, filter fetched range records) - Implementations (MemCacheManager, SembastCacheManager, etc.) should
implement this method
Alternatives Considered
Currently I call each removeAll* method individually:
final cache = ndk.config.cache;
await cache.removeAllEvents();
await cache.removeAllUserRelayLists();
await cache.removeAllRelaySets();
await cache.removeAllContactLists();
await cache.removeAllMetadatas();
await cache.removeAllNip05s();
await cache.removeAllFilterFetchedRangeRecords();This works but is verbose and requires updating client code if new cache types
are added in the future.
Additional Context
Proposed API:
abstract class CacheManager {
// ... existing methods ...
/// Clears all cached data
Future<void> clearAll();
}Reactions are currently unavailable