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
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -288,6 +288,45 @@ storage.async.removeExpiredObjects() { result in
288
288
}
289
289
```
290
290
291
+
#### Swift Concurrency
292
+
293
+
```swift
294
+
do {
295
+
tryawait storage.async.setObject("Oslo", forKey: "my favorite city")
296
+
print("saved successfully")
297
+
} catch {
298
+
print(error)
299
+
}
300
+
301
+
do {
302
+
let city =tryawait storage.async.object(forKey: "my favorite city")
303
+
print("my favorite city is \(city)")
304
+
} catch {
305
+
print(error)
306
+
}
307
+
308
+
do {
309
+
let exists =tryawait storage.async.objectExists(forKey: "my favorite city")
310
+
if exists {
311
+
print("I have a favorite city")
312
+
}
313
+
} catch {}
314
+
315
+
do {
316
+
tryawait storage.async.remoeAll()
317
+
print("removal completes")
318
+
} catch {
319
+
print(error)
320
+
}
321
+
322
+
do {
323
+
tryawait storage.async.removeExpiredObjects()
324
+
print("removal completes")
325
+
} catch {
326
+
print(error)
327
+
}
328
+
```
329
+
291
330
### Expiry date
292
331
293
332
By default, all saved objects have the same expiry as the expiry you specify in `DiskConfig` or `MemoryConfig`. You can overwrite this for a specific object by specifying `expiry` for `setObject`
0 commit comments