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
+3-8Lines changed: 3 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,12 @@ A Swift client library for Valkey.
4
4
5
5
## Usage
6
6
7
-
The valkey-swift project uses a connection pool, which requires a background process to manage it. You can either run it using a Task group
7
+
The valkey-swift project uses a connection pool, which requires a background process to manage it. You can either run it using a TaskGroup or async let. Below we are using async let to run the connection pool background process.
8
8
9
9
```swift
10
10
let valkeyClient =ValkeyClient(.hostname("localhost", port: 6379), logger: logger)
11
-
tryawaitwithThrowingTaskGroup(of: Void.self) { group in
12
-
group.addTask {
13
-
// run connection pool in the background
14
-
await valkeyClient.run()
15
-
}
16
-
// use valkey client
17
-
}
11
+
asynclet_= valkeyClient.run()
12
+
// use valkey client
18
13
```
19
14
20
15
Or you can use ValkeyClient with [swift-service-lifecycle](https://github.com/swift-server/swift-service-lifecycle).
0 commit comments