@@ -21,6 +21,10 @@ Rultor.com](https://www.rultor.com/b/dartoos-dev/json_cache)](https://www.rultor
2121
2222- [ Overview] ( #overview )
2323- [ Getting Started] ( #getting-started )
24+ - [ List of JsonCache implementations] ( #list-of-jsoncache-implementations )
25+ - [ JsonCacheMem — Thread-safe In-memory cache] ( #jsoncachemem )
26+ - [ JsonCachePrefs — SharedPreferences] ( #jsoncacheprefs )
27+ - [ JsonCacheLocalStorage — LocalStorage] ( #jsoncachelocalstorage )
2428- [ Demo application] ( #demo-application )
2529- [ References] ( #references )
2630
@@ -90,17 +94,29 @@ represents the name of a single data group. For example:
9094Above, the _ profile_ key is associated with the profile-related data group,
9195while the _ preferences_ key is associated with the preferences-related data.
9296
97+ ## List of JsonCache Implementations
98+
99+ The library
100+ [ JsonCache] ( https://pub.dev/documentation/json_cache/latest/json_cache/json_cache-library.html )
101+ contains all the classes that implement the
102+ [ JsonCache] ( https://pub.dev/documentation/json_cache/latest/json_cache/JsonCache-class.html )
103+ interface with more in-depth details.
104+
105+ The following sections are an overview of each implementation.
106+
93107### JsonCacheMem
94108
95- It is a thread-safe, in-memory implementation of the ` JsonCache ` interface.
109+ [ JsonCacheMem] ( https://pub.dev/documentation/json_cache/latest/json_cache/JsonCacheMem-class.html )
110+ is is a thread-safe in-memory implementation of the ` JsonCache ` interface.
96111Moreover, it encapsulates a secondary cache or "slower level2 cache". Typically,
97112the secondary cache instance is responsible for the local cache; that is, it is
98113the cache instance that persists data on the user's device.
99114
100- #### JsonCacheMem Usage
115+ #### Typical Usage
101116
102117Due to the fact that ` JsonCacheMem ` is a decorator, you should always pass
103- another ` JsonCache ` instance when you instantiates it. For example:
118+ another ` JsonCache ` instance to it whenever you instantiates a ` JsonCacheMem `
119+ object. For example:
104120
105121``` dart
106122 …
@@ -109,6 +125,32 @@ another `JsonCache` instance when you instantiates it. For example:
109125 …
110126```
111127
128+ ### JsonCachePrefs
129+
130+ [ JsonCachePrefs] ( https://pub.dev/documentation/json_cache/latest/json_cache/JsonCachePrefs-class.html )
131+ is an implementation on top of the
132+ [ shared_preferences] ( https://pub.dev/packages/shared_preferences ) package.
133+
134+ ``` dart
135+ …
136+ final prefs = await SharedPreferences.getInstance();
137+ final JsonCache jsonCache = JsonCacheMem(JsonCachePrefs(prefs));
138+ …
139+ ```
140+
141+ ### JsonCacheLocalStorage
142+
143+ [ JsonCacheLocalStorage] ( https://pub.dev/documentation/json_cache/latest/json_cache/JsonCacheLocalStorage-class.html )
144+ is an implementation on top of the
145+ [ shared_preferences] ( https://pub.dev/packages/shared_preferences ) package.
146+
147+ ``` dart
148+ …
149+ final LocalStorage storage = LocalStorage('my_data');
150+ final JsonCache jsonCache = JsonCacheMem(JsonCacheLocalStorage(storage));
151+ …
152+ ```
153+
112154## Demo application
113155
114156The demo application provides a fully working example, focused on demonstrating
0 commit comments