You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-5Lines changed: 12 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,24 +36,31 @@ with out-of-box implementations and great customization possibilities. `Cache` u
36
36
## Key features
37
37
38
38
-[x] Work with Swift 4 `Codable`. Anything conforming to `Codable` will be saved and loaded easily by `Storage`.
39
-
-[X] Disk storage by default. Optionally using `memory storage` to enable hybrid.
39
+
-[x] Hybrid with memory and disk storage.
40
40
-[X] Many options via `DiskConfig` and `MemoryConfig`.
41
41
-[x] Support `expiry` and clean up of expired objects.
42
42
-[x] Thread safe. Operations can be accessed from any queue.
43
43
-[x] Sync by default. Also support Async APIs.
44
-
-[X] Store images via `ImageWrapper`.
45
44
-[x] Extensive unit test coverage and great documentation.
46
45
-[x] iOS, tvOS and macOS support.
47
46
48
47
## Usage
49
48
50
49
### Storage
51
50
52
-
`Cache` is built based on [Chain-of-responsibility pattern](https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern), in which there are many processing objects, each knows how to do 1 task and delegates to the next one. But that's just implementation detail. All you need to know is `Storage`, it saves and loads `Codable` objects.
51
+
`Cache` is built based on [Chain-of-responsibility pattern](https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern), in which there are many processing objects, each knows how to do 1 task and delegates to the next one, so can you compose Storages the way you like.
53
52
54
-
`Storage` has disk storage and an optional memory storage. Memory storage should be less time and memory consuming, while disk storage is used for content that outlives the application life-cycle, see it more like a convenient way to store user information that should persist across application launches.
53
+
For now the following Storage are supported
55
54
56
-
`DiskConfig` is required to set up disk storage. You can optionally pass `MemoryConfig` to use memory as front storage.
55
+
-`MemoryStorage`: save object to memory.
56
+
-`DiskStorage`: save object to disk.
57
+
-`HybridStorage`: save object to memory and disk, so you get persistented object on disk, while fast access with in memory objects.
58
+
-`SyncStorage`: blocking APIs, all read and write operations are scheduled in a serial queue, all sync manner.
59
+
-`AsyncStorage`: non-blocking APIs, operations are scheduled in an internal queue for serial processing. No read and write should happen at the same time.
60
+
61
+
Although you can use those Storage at your discretion, you don't have to. Because we also provide a convenient `Storage` which uses `HybridStorage` under the hood, while exposes sync and async APIs through `SyncStorage` and `AsyncStorage`.
62
+
63
+
All you need to do is to specify the configuration you want with `DiskConfig` and `MemoryConfig`. The default configurations are good to go, but you can customise a lot.
0 commit comments