@@ -50,31 +50,33 @@ cached data. It is defined as:
5050``` dart
5151/// Represents data cached in json.
5252abstract class JsonCache {
53- /// Frees up cache storage space.
53+ /// Frees up storage space.
5454 Future<void> clear();
5555
56- /// Updates cached data found by its associated [key].
56+ /// Updates data at [key] or creates a new cache line at [key] if there is no
57+ /// previous data there.
5758 Future<void> refresh(String key, Map<String, dynamic> data);
5859
59- /// Erases [key] and returns its associated data.
60+ /// Removes data from cache at [key] and returns it or returns null if there
61+ /// is no data at [key].
6062 Future<Map<String, dynamic>?> erase(String key);
6163
62- /// Recovers cached data by [key]; returns null if a cache miss occurs.
64+ /// Retrieves either the data at [key] or null if a cache miss occurs.
6365 Future<Map<String, dynamic>?> recover(String key);
6466}
6567```
6668
6769It is reasonable to consider each cache entry (a key/data pair) as a group of
68- related data. Thus, it is expected to cache user data into groups where a key
70+ related data. Thus, it is expected to cache data into groups, where a key
6971represents the name of a single data group. For example:
7072
7173``` dart
7274'profile': {'name': 'John Doe', 'email': 'johndoe@email.com', 'accountType': 'premium'};
7375'preferences': {'theme': {'dark': true}, 'notifications':{'enabled': true}}
7476```
7577
76- Above the _ 'profile'_ key is associated with the group of profile related data;
77- _ 'preferences'_ , with preferences data.
78+ Above the _ 'profile'_ key is associated with the group of profile- related data,
79+ while _ 'preferences'_ is associated with preferences-related data.
7880
7981<!-- @todo #10 Some implementation is needed to add more examples -->
8082
0 commit comments