mirror of https://github.com/vapor/docs.git
Fix Dead Links (#770)
* Fix Leaf links * Fix NIO links * Fix up more links * Fix Redis links * Update image links
This commit is contained in:
parent
ff7cadd323
commit
067ac31294
|
|
@ -1,6 +1,6 @@
|
||||||
# Files
|
# Files
|
||||||
|
|
||||||
Vapor offers a simple API for reading and writing files asynchronously within route handlers. This API is built on top of NIO's [`NonBlockingFileIO`](https://apple.github.io/swift-nio/docs/current/NIOPosix/Structs/NonBlockingFileIO.html) type.
|
Vapor offers a simple API for reading and writing files asynchronously within route handlers. This API is built on top of NIO's [`NonBlockingFileIO`](https://swiftpackageindex.com/apple/swift-nio/main/documentation/nioposix/nonblockingfileio) type.
|
||||||
|
|
||||||
## Read
|
## Read
|
||||||
|
|
||||||
|
|
@ -94,4 +94,4 @@ let fileHandle = try await req.application.fileio.openFile(
|
||||||
print(fileHandle)
|
print(fileHandle)
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information, visit SwiftNIO's [API reference](https://apple.github.io/swift-nio/docs/current/NIOPosix/Structs/NonBlockingFileIO.html).
|
For more information, visit SwiftNIO's [API reference](https://swiftpackageindex.com/apple/swift-nio/main/documentation/nioposix/nonblockingfileio).
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Bestanden
|
# Bestanden
|
||||||
|
|
||||||
Vapor biedt een eenvoudige API voor het asynchroon lezen en schrijven van bestanden binnen route handlers. Deze API is gebouwd op NIO's [`NonBlockingFileIO`](https://apple.github.io/swift-nio/docs/current/NIOPosix/Structs/NonBlockingFileIO.html) type.
|
Vapor biedt een eenvoudige API voor het asynchroon lezen en schrijven van bestanden binnen route handlers. Deze API is gebouwd op NIO's [`NonBlockingFileIO`](https://swiftpackageindex.com/apple/swift-nio/main/documentation/nioposix/nonblockingfileio) type.
|
||||||
|
|
||||||
## Lezen
|
## Lezen
|
||||||
|
|
||||||
|
|
@ -94,4 +94,4 @@ let fileHandle = try await req.application.fileio.openFile(
|
||||||
print(fileHandle)
|
print(fileHandle)
|
||||||
```
|
```
|
||||||
|
|
||||||
Ga voor meer informatie naar SwiftNIO's [API referentie](https://apple.github.io/swift-nio/docs/current/NIOPosix/Structs/NonBlockingFileIO.html).
|
Ga voor meer informatie naar SwiftNIO's [API referentie](https://swiftpackageindex.com/apple/swift-nio/main/documentation/nioposix/nonblockingfileio).
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 文件
|
# 文件
|
||||||
|
|
||||||
Vapor 提供了基于 [NIO](https://apple.github.io/swift-nio/docs/current/NIOPosix/Structs/NonBlockingFileIO.html) 构建的 API,用于异步处理路由内部的文件读取和写入。
|
Vapor 提供了基于 [NIO](https://swiftpackageindex.com/apple/swift-nio/main/documentation/nioposix/nonblockingfileio) 构建的 API,用于异步处理路由内部的文件读取和写入。
|
||||||
|
|
||||||
## 读取
|
## 读取
|
||||||
|
|
||||||
|
|
@ -94,4 +94,4 @@ let fileHandle = try await req.application.fileio.openFile(
|
||||||
print(fileHandle)
|
print(fileHandle)
|
||||||
```
|
```
|
||||||
|
|
||||||
了解更多信息,请参阅 SwiftNIO 的 [API 文档](https://apple.github.io/swift-nio/docs/current/NIOPosix/Structs/NonBlockingFileIO.html)。
|
了解更多信息,请参阅 SwiftNIO 的 [API 文档](https://swiftpackageindex.com/apple/swift-nio/main/documentation/nioposix/nonblockingfileio)。
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ extension HTML: AsyncResponseEncodable {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that this allows customizing the `Content-Type` header. See [`HTTPHeaders` reference](https://api.vapor.codes/vapor/main/Vapor/) for more details.
|
Note that this allows customizing the `Content-Type` header. See [`HTTPHeaders` reference](https://api.vapor.codes/vapor/documentation/vapor/response/headers) for more details.
|
||||||
|
|
||||||
You can then use `HTML` as a response type in your routes:
|
You can then use `HTML` as a response type in your routes:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ extension HTML: AsyncResponseEncodable {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Merk op dat dit het mogelijk maakt om de `Content-Type` header aan te passen. Zie [`HTTPHeaders` reference](https://api.vapor.codes/vapor/main/Vapor/) voor meer details.
|
Merk op dat dit het mogelijk maakt om de `Content-Type` header aan te passen. Zie [`HTTPHeaders` reference](https://api.vapor.codes/vapor/documentation/vapor/response/headers) voor meer details.
|
||||||
|
|
||||||
U kunt dan `HTML` gebruiken als response type in uw routes:
|
U kunt dan `HTML` gebruiken als response type in uw routes:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ extension HTML: AsyncResponseEncodable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
注意,它允许自定义 `Content-Type` 头,查看更多请查阅 [`HTTPHeaders` 文档](https://api.vapor.codes/vapor/main/Vapor/)
|
注意,它允许自定义 `Content-Type` 头,查看更多请查阅 [`HTTPHeaders` 文档](https://api.vapor.codes/vapor/documentation/vapor/response/headers)
|
||||||
|
|
||||||
接下来,你可以在你的路由中使用 `HTML` 作为响应类型:
|
接下来,你可以在你的路由中使用 `HTML` 作为响应类型:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Laten we beginnen met het installeren van Swift op een Linux server. Gebruik het
|
||||||
|
|
||||||
Onder distributies, selecteer Ubuntu 18.04 LTS. De volgende gids zal deze versie als voorbeeld gebruiken.
|
Onder distributies, selecteer Ubuntu 18.04 LTS. De volgende gids zal deze versie als voorbeeld gebruiken.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
!!! note "Opmerking"
|
!!! note "Opmerking"
|
||||||
U kunt elke Linux distributie kiezen met een versie die Swift ondersteunt. Op het moment van schrijven ondersteunt Swift 5.2.4 Ubuntu 16.04, 18.04, 20.04, CentOS 8, en Amazon Linux 2. U kunt controleren welke besturingssystemen officieel worden ondersteund op de [Swift Releases](https://swift.org/download/#releases) pagina.
|
U kunt elke Linux distributie kiezen met een versie die Swift ondersteunt. Op het moment van schrijven ondersteunt Swift 5.2.4 Ubuntu 16.04, 18.04, 20.04, CentOS 8, en Amazon Linux 2. U kunt controleren welke besturingssystemen officieel worden ondersteund op de [Swift Releases](https://swift.org/download/#releases) pagina.
|
||||||
|
|
@ -84,7 +84,7 @@ sudo apt-get install clang libicu-dev libatomic1 build-essential pkg-config
|
||||||
|
|
||||||
Deze handleiding installeert Swift 5.2.4. Bezoek de [Swift Releases](https://swift.org/download/#releases) pagina voor een link naar de laatste release. Kopieer de download link voor Ubuntu 18.04.
|
Deze handleiding installeert Swift 5.2.4. Bezoek de [Swift Releases](https://swift.org/download/#releases) pagina voor een link naar de laatste release. Kopieer de download link voor Ubuntu 18.04.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Download en decomprimeer de Swift toolchain.
|
Download en decomprimeer de Swift toolchain.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
在发行版下,选择 Ubuntu 18.04 LTS。以下指南将以此版本为例。
|
在发行版下,选择 Ubuntu 18.04 LTS。以下指南将以此版本为例。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
!!! note "注意"
|
!!! note "注意"
|
||||||
你也可以选择 Swift 支持的其它 Linux 发行版。在撰写本文时, Swift 5.2.4 支持 Ubuntu 16.04、18.04、20.04、CentOS 8, 和 Amazon Linux 2。你可以在 [Swift Releases](https://swift.org/download/#releases) 页面上查看官方支持哪些操作系统。
|
你也可以选择 Swift 支持的其它 Linux 发行版。在撰写本文时, Swift 5.2.4 支持 Ubuntu 16.04、18.04、20.04、CentOS 8, 和 Amazon Linux 2。你可以在 [Swift Releases](https://swift.org/download/#releases) 页面上查看官方支持哪些操作系统。
|
||||||
|
|
@ -84,7 +84,7 @@ sudo apt-get install clang libicu-dev libatomic1 build-essential pkg-config
|
||||||
|
|
||||||
本指南将安装 Swift 5.2.4。访问 [Swift Releases](https://swift.org/download/#releases) 页面获取最新版本的链接。复制 Ubuntu 18.04 的下载链接。
|
本指南将安装 Swift 5.2.4。访问 [Swift Releases](https://swift.org/download/#releases) 页面获取最新版本的链接。复制 Ubuntu 18.04 的下载链接。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
下载并解压 Swift toolchain。
|
下载并解压 Swift toolchain。
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Custom Tags
|
# Custom Tags
|
||||||
|
|
||||||
You can create custom Leaf tags using the [`LeafTag`](https://api.vapor.codes/leaf-kit/main/LeafKit/LeafTag) protocol.
|
You can create custom Leaf tags using the [`LeafTag`](https://api.vapor.codes/leafkit/documentation/leafkit/leaftag) protocol.
|
||||||
|
|
||||||
To demonstrate this, let's take a look at creating a custom tag `#now` that prints the current timestamp. The tag will also support a single, optional parameter for specifying the date format.
|
To demonstrate this, let's take a look at creating a custom tag `#now` that prints the current timestamp. The tag will also support a single, optional parameter for specifying the date format.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Aangepaste Tags
|
# Aangepaste Tags
|
||||||
|
|
||||||
U kunt aangepaste Leaf tags maken met het [`LeafTag`](https://api.vapor.codes/leaf-kit/main/LeafKit/LeafTag/) protocol.
|
U kunt aangepaste Leaf tags maken met het [`LeafTag`](https://api.vapor.codes/leafkit/documentation/leafkit/leaftag) protocol.
|
||||||
|
|
||||||
Om dit te demonstreren, laten we eens kijken naar het maken van een aangepaste tag `#now` die de huidige tijdstempel afdrukt. De tag ondersteunt ook een enkele, optionele parameter voor het specificeren van het datumformaat.
|
Om dit te demonstreren, laten we eens kijken naar het maken van een aangepaste tag `#now` die de huidige tijdstempel afdrukt. De tag ondersteunt ook een enkele, optionele parameter voor het specificeren van het datumformaat.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# 自定义标签
|
# 自定义标签
|
||||||
|
|
||||||
你可以遵循 [`LeafTag`](https://api.vapor.codes/leaf-kit/main/LeafKit/LeafTag/) 协议来创建自定义的 Leaf 标签。
|
你可以遵循 [`LeafTag`](https://api.vapor.codes/leafkit/documentation/leafkit/leaftag) 协议来创建自定义的 Leaf 标签。
|
||||||
|
|
||||||
为了演示这一点,让我们看看创建一个 `#now` 标签来打印当前时间戳。标签还支持一个可选参数来指定日期格式。
|
为了演示这一点,让我们看看创建一个 `#now` 标签来打印当前时间戳。标签还支持一个可选参数来指定日期格式。
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ This tells Vapor to use the `LeafRenderer` when you call `req.view` in your code
|
||||||
|
|
||||||
Once you have configured Leaf, you will need to ensure you have a `Views` folder to store your `.leaf` files in. By default, Leaf expects the views folder to be a `./Resources/Views` relative to your project's root.
|
Once you have configured Leaf, you will need to ensure you have a `Views` folder to store your `.leaf` files in. By default, Leaf expects the views folder to be a `./Resources/Views` relative to your project's root.
|
||||||
|
|
||||||
You will also likely want to enable Vapor's [`FileMiddleware`](https://api.vapor.codes/vapor/main/Vapor/FileMiddleware/) to serve files from your `/Public` folder if you plan on serving Javascript and CSS files for instance.
|
You will also likely want to enable Vapor's [`FileMiddleware`](https://api.vapor.codes/vapor/documentation/vapor/filemiddleware) to serve files from your `/Public` folder if you plan on serving Javascript and CSS files for instance.
|
||||||
|
|
||||||
```
|
```
|
||||||
VaporApp
|
VaporApp
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ Dit vertelt Vapor om de `LeafRenderer` te gebruiken wanneer u `req.view` aanroep
|
||||||
|
|
||||||
Zodra je Leaf hebt geconfigureerd, moet je er voor zorgen dat je een `Views` map hebt om je `.leaf` bestanden in op te slaan. Standaard verwacht Leaf dat de views map een `./Resources/Views` is relatief aan de root van je project.
|
Zodra je Leaf hebt geconfigureerd, moet je er voor zorgen dat je een `Views` map hebt om je `.leaf` bestanden in op te slaan. Standaard verwacht Leaf dat de views map een `./Resources/Views` is relatief aan de root van je project.
|
||||||
|
|
||||||
U zult waarschijnlijk ook Vapor's [`FileMiddleware`](https://api.vapor.codes/vapor/main/Vapor/FileMiddleware/) willen inschakelen om bestanden uit uw `/Public` folder te serveren als u van plan bent om bijvoorbeeld Javascript en CSS bestanden te serveren.
|
U zult waarschijnlijk ook Vapor's [`FileMiddleware`](https://api.vapor.codes/vapor/documentation/vapor/filemiddleware) willen inschakelen om bestanden uit uw `/Public` folder te serveren als u van plan bent om bijvoorbeeld Javascript en CSS bestanden te serveren.
|
||||||
|
|
||||||
```
|
```
|
||||||
VaporApp
|
VaporApp
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ app.views.use(.leaf)
|
||||||
|
|
||||||
一旦你配置了 Leaf,你需要确保有一个 `Views` 文件夹来存储 `.leaf` 文件。默认情况下,Leaf 期望文件夹位于相对于项目根目录的 `./Resources/Views` 中。
|
一旦你配置了 Leaf,你需要确保有一个 `Views` 文件夹来存储 `.leaf` 文件。默认情况下,Leaf 期望文件夹位于相对于项目根目录的 `./Resources/Views` 中。
|
||||||
|
|
||||||
例如,如果你计划提供 Javascript 和 CSS 文件,你可能还希望启用 Vapor 的 [`FileMiddleware`](https://api.vapor.codes/vapor/main/Vapor/FileMiddleware/) 服务来提供 `/Public` 文件夹中的文件。
|
例如,如果你计划提供 Javascript 和 CSS 文件,你可能还希望启用 Vapor 的 [`FileMiddleware`](https://api.vapor.codes/vapor/documentation/vapor/filemiddleware) 服务来提供 `/Public` 文件夹中的文件。
|
||||||
|
|
||||||
```
|
```
|
||||||
VaporApp
|
VaporApp
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ app.redis.configuration = try RedisConfiguration(hostname: "localhost")
|
||||||
|
|
||||||
### Redis Configuration
|
### Redis Configuration
|
||||||
|
|
||||||
> API Documentation: [`RedisConfiguration`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration/)
|
> API Documentation: [`RedisConfiguration`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration)
|
||||||
|
|
||||||
#### serverAddresses
|
#### serverAddresses
|
||||||
|
|
||||||
If you have multiple Redis endpoints, such as a cluster of Redis instances, you'll want to create a [`[SocketAddress]`](https://apple.github.io/swift-nio/docs/current/NIOCore/Enums/SocketAddress.html#/s:3NIO13SocketAddressO04makeC13ResolvingHost_4portACSS_SitKFZ) collection to pass in the initializer instead.
|
If you have multiple Redis endpoints, such as a cluster of Redis instances, you'll want to create a [`[SocketAddress]`](https://swiftpackageindex.com/apple/swift-nio/main/documentation/niocore/socketaddress) collection to pass in the initializer instead.
|
||||||
|
|
||||||
The most common way of creating a `SocketAddress` is with the [`makeAddressResolvingHost(_:port:)`](https://apple.github.io/swift-nio/docs/current/NIOCore/Enums/SocketAddress.html#/s:3NIO13SocketAddressO04makeC13ResolvingHost_4portACSS_SitKFZ) static method.
|
The most common way of creating a `SocketAddress` is with the [`makeAddressResolvingHost(_:port:)`](https://swiftpackageindex.com/apple/swift-nio/main/documentation/niocore/socketaddress/makeaddressresolvinghost(_:port:)) static method.
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
let serverAddresses: [SocketAddress] = [
|
let serverAddresses: [SocketAddress] = [
|
||||||
|
|
@ -60,8 +60,8 @@ let serverAddresses: [SocketAddress] = [
|
||||||
|
|
||||||
For a single Redis endpoint, it can be easier to work with the convenience initializers, as it will handle creating the `SocketAddress` for you:
|
For a single Redis endpoint, it can be easier to work with the convenience initializers, as it will handle creating the `SocketAddress` for you:
|
||||||
|
|
||||||
- [`.init(url:pool)`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration/#redisconfiguration.init(url:pool:)) (with `String` or [`Foundation.URL`](https://developer.apple.com/documentation/foundation/url))
|
- [`.init(url:pool)`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration/init(url:tlsconfiguration:pool:)-o9lf) (with `String` or [`Foundation.URL`](https://developer.apple.com/documentation/foundation/url))
|
||||||
- [`.init(hostname:port:password:database:pool:)`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration/#redisconfiguration.init(hostname:port:password:database:pool:))
|
- [`.init(hostname:port:password:database:pool:)`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration/init(hostname:port:password:tlsconfiguration:database:pool:))
|
||||||
|
|
||||||
#### password
|
#### password
|
||||||
|
|
||||||
|
|
@ -80,7 +80,7 @@ This saves you from having to send the `SELECT` command to Redis yourself.
|
||||||
|
|
||||||
### Connection Pool Options
|
### Connection Pool Options
|
||||||
|
|
||||||
> API Documentation: [`RedisConfiguration.PoolOptions`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration_PoolOptions/)
|
> API Documentation: [`RedisConfiguration.PoolOptions`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration/pooloptions)
|
||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
Only the most commonly changed options are highlighted here. For all of the options, refer to the API documentation.
|
Only the most commonly changed options are highlighted here. For all of the options, refer to the API documentation.
|
||||||
|
|
@ -102,7 +102,7 @@ This option determines the behavior of how the maximum connection count is maint
|
||||||
|
|
||||||
## Sending a Command
|
## Sending a Command
|
||||||
|
|
||||||
You can send commands using the `.redis` property on any [`Application`](https://api.vapor.codes/vapor/main/Vapor/Application/) or [`Request`](https://api.vapor.codes/vapor/main/Vapor/Request/) instance, which will give you access to a [`RedisClient`](https://swiftpackageindex.com/mordil/redistack/1.3.2/documentation/redistack/redisclient).
|
You can send commands using the `.redis` property on any [`Application`](https://api.vapor.codes/vapor/documentation/vapor/application) or [`Request`](https://api.vapor.codes/vapor/documentation/vapor/request) instance, which will give you access to a [`RedisClient`](https://swiftpackageindex.com/mordil/redistack/1.3.2/documentation/redistack/redisclient).
|
||||||
|
|
||||||
Any `RedisClient` has several extensions for all of the various [Redis commands](https://redis.io/commands).
|
Any `RedisClient` has several extensions for all of the various [Redis commands](https://redis.io/commands).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ app.redis.configuration = try RedisConfiguration(hostname: "localhost")
|
||||||
|
|
||||||
### Redis Configuratie
|
### Redis Configuratie
|
||||||
|
|
||||||
> API Documentatie: [`RedisConfiguration`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration/)
|
> API Documentatie: [`RedisConfiguration`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration)
|
||||||
|
|
||||||
#### serverAddresses
|
#### serverAddresses
|
||||||
|
|
||||||
Als u meerdere Redis eindpunten heeft, zoals een cluster van Redis instanties, dan kunt u beter een [`[SocketAddress]`](https://apple.github.io/swift-nio/docs/current/NIOCore/Enums/SocketAddress.html#/s:3NIO13SocketAddressO04makeC13ResolvingHost_4portACSS_SitKFZ) verzameling maken om in plaats daarvan de initializer mee te geven.
|
Als u meerdere Redis eindpunten heeft, zoals een cluster van Redis instanties, dan kunt u beter een [`[SocketAddress]`](https://swiftpackageindex.com/apple/swift-nio/main/documentation/niocore/socketaddress) verzameling maken om in plaats daarvan de initializer mee te geven.
|
||||||
|
|
||||||
De meest gebruikelijke manier om een `SocketAddress` aan te maken is met de [`makeAddressResolvingHost(_:port:)`](https://apple.github.io/swift-nio/docs/current/NIOCore/Enums/SocketAddress.html#/s:3NIO13SocketAddressO04makeC13ResolvingHost_4portACSS_SitKFZ) statische methode.
|
De meest gebruikelijke manier om een `SocketAddress` aan te maken is met de [`makeAddressResolvingHost(_:port:)`](https://swiftpackageindex.com/apple/swift-nio/main/documentation/niocore/socketaddress/makeaddressresolvinghost(_:port:)) statische methode.
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
let serverAddresses: [SocketAddress] = [
|
let serverAddresses: [SocketAddress] = [
|
||||||
|
|
@ -60,8 +60,8 @@ let serverAddresses: [SocketAddress] = [
|
||||||
|
|
||||||
Voor een enkel Redis endpoint, kan het makkelijker zijn om met de convenience initializers te werken, omdat die het `SocketAddress` voor je aanmaken:
|
Voor een enkel Redis endpoint, kan het makkelijker zijn om met de convenience initializers te werken, omdat die het `SocketAddress` voor je aanmaken:
|
||||||
|
|
||||||
- [`.init(url:pool)`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration/#redisconfiguration.init(url:pool:)) (met `String` of [`Foundation.URL`](https://developer.apple.com/documentation/foundation/url))
|
- [`.init(url:pool)`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration/init(url:tlsconfiguration:pool:)-o9lf) (met `String` of [`Foundation.URL`](https://developer.apple.com/documentation/foundation/url))
|
||||||
- [`.init(hostname:port:password:database:pool:)`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration/#redisconfiguration.init(hostname:port:password:database:pool:))
|
- [`.init(hostname:port:password:database:pool:)`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration/init(hostname:port:password:tlsconfiguration:database:pool:))
|
||||||
|
|
||||||
#### wachtwoord
|
#### wachtwoord
|
||||||
|
|
||||||
|
|
@ -80,7 +80,7 @@ Dit bespaart u het `SELECT` commando zelf naar Redis te moeten sturen.
|
||||||
|
|
||||||
### Connection Pool Opties
|
### Connection Pool Opties
|
||||||
|
|
||||||
> API Documentatie: [`RedisConfiguration.PoolOptions`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration_PoolOptions/)
|
> API Documentatie: [`RedisConfiguration.PoolOptions`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration/pooloptions)
|
||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
Alleen de opties die het meest worden gewijzigd worden hier uitgelicht. Voor alle opties, raadpleeg de API documentatie.
|
Alleen de opties die het meest worden gewijzigd worden hier uitgelicht. Voor alle opties, raadpleeg de API documentatie.
|
||||||
|
|
@ -102,7 +102,7 @@ Deze optie bepaalt het gedrag van hoe het maximum aantal verbindingen wordt bijg
|
||||||
|
|
||||||
## Een commando versturen
|
## Een commando versturen
|
||||||
|
|
||||||
Je kunt commando's sturen met de `.redis` eigenschap op elke [`Application`](https://api.vapor.codes/vapor/main/Vapor/Application/) of [`Request`](https://api.vapor.codes/vapor/main/Vapor/Request/) instantie, die je toegang geeft tot een [`RedisClient`](https://swiftpackageindex.com/mordil/redistack/1.3.2/documentation/redistack/redisclient).
|
Je kunt commando's sturen met de `.redis` eigenschap op elke [`Application`](https://api.vapor.codes/vapor/documentation/vapor/application) of [`Request`](https://api.vapor.codes/vapor/documentation/vapor/request) instantie, die je toegang geeft tot een [`RedisClient`](https://swiftpackageindex.com/mordil/redistack/1.3.2/documentation/redistack/redisclient).
|
||||||
|
|
||||||
Elke `RedisClient` heeft verschillende extensies voor alle verschillende [Redis commando's](https://redis.io/commands).
|
Elke `RedisClient` heeft verschillende extensies voor alle verschillende [Redis commando's](https://redis.io/commands).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ app.redis.configuration = try RedisConfiguration(hostname: "localhost")
|
||||||
|
|
||||||
### Redis 配置
|
### Redis 配置
|
||||||
|
|
||||||
> API 文档:[`RedisConfiguration`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration/)
|
> API 文档:[`RedisConfiguration`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration)
|
||||||
|
|
||||||
#### 服务器地址
|
#### 服务器地址
|
||||||
|
|
||||||
如果你有多个 Redis 端点,比如一个 Redis 实例集群,你需要创建一个 [`[SocketAddress]`](https://apple.github.io/swift-nio/docs/current/NIOCore/Enums/SocketAddress.html#/s:3NIO13SocketAddressO04makeC13ResolvingHost_4portACSS_SitKFZ) 集合来传递给初始化器。
|
如果你有多个 Redis 端点,比如一个 Redis 实例集群,你需要创建一个 [`[SocketAddress]`](https://swiftpackageindex.com/apple/swift-nio/main/documentation/niocore/socketaddress) 集合来传递给初始化器。
|
||||||
|
|
||||||
创建 `SocketAddress` 最常见的方法是使用 [`makeAddressResolvingHost(_:port:)`](https://apple.github.io/swift-nio/docs/current/NIOCore/Enums/SocketAddress.html#/s:3NIO13SocketAddressO04makeC13ResolvingHost_4portACSS_SitKFZ) 静态方法。
|
创建 `SocketAddress` 最常见的方法是使用 [`makeAddressResolvingHost(_:port:)`](https://swiftpackageindex.com/apple/swift-nio/main/documentation/niocore/socketaddress/makeaddressresolvinghost(_:port:)) 静态方法。
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
let serverAddresses: [SocketAddress] = [
|
let serverAddresses: [SocketAddress] = [
|
||||||
|
|
@ -60,8 +60,8 @@ let serverAddresses: [SocketAddress] = [
|
||||||
|
|
||||||
对于单个 Redis 端点,使用便利构造器初始化更容易,因为它将为你创建 `SocketAddress`:
|
对于单个 Redis 端点,使用便利构造器初始化更容易,因为它将为你创建 `SocketAddress`:
|
||||||
|
|
||||||
- [`.init(url:pool)`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration/#redisconfiguration.init(url:pool:)) (带 `String` 或 [`Foundation.URL`](https://developer.apple.com/documentation/foundation/url))
|
- [`.init(url:pool)`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration/init(url:tlsconfiguration:pool:)-o9lf) (带 `String` 或 [`Foundation.URL`](https://developer.apple.com/documentation/foundation/url))
|
||||||
- [`.init(hostname:port:password:database:pool:)`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration/#redisconfiguration.init(hostname:port:password:database:pool:))
|
- [`.init(hostname:port:password:database:pool:)`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration/init(hostname:port:password:tlsconfiguration:database:pool:))
|
||||||
|
|
||||||
#### 密码
|
#### 密码
|
||||||
|
|
||||||
|
|
@ -80,7 +80,7 @@ let serverAddresses: [SocketAddress] = [
|
||||||
|
|
||||||
### 连接池选项
|
### 连接池选项
|
||||||
|
|
||||||
> API 文档:[`RedisConfiguration.PoolOptions`](https://api.vapor.codes/redis/main/Redis/RedisConfiguration_PoolOptions/)
|
> API 文档:[`RedisConfiguration.PoolOptions`](https://api.vapor.codes/redis/documentation/redis/redisconfiguration/pooloptions)
|
||||||
|
|
||||||
!!! note "注意"
|
!!! note "注意"
|
||||||
这里只突出显示最常更改的选项。对于所有选项,请参考 API 文档。
|
这里只突出显示最常更改的选项。对于所有选项,请参考 API 文档。
|
||||||
|
|
@ -102,7 +102,7 @@ let serverAddresses: [SocketAddress] = [
|
||||||
|
|
||||||
## 发送命令
|
## 发送命令
|
||||||
|
|
||||||
你可以使用 [`Application`](https://api.vapor.codes/vapor/main/Vapor/Application/) 或 [`Request`](https://api.vapor.codes/vapor/main/Vapor/Request/) 实例上的 `.redis` 属性发送命令,这使得你可以访问 [`RedisClient`](https://swiftpackageindex.com/mordil/redistack/1.3.2/documentation/redistack/redisclient)。
|
你可以使用 [`Application`](https://api.vapor.codes/vapor/documentation/vapor/application) 或 [`Request`](https://api.vapor.codes/vapor/documentation/vapor/request) 实例上的 `.redis` 属性发送命令,这使得你可以访问 [`RedisClient`](https://swiftpackageindex.com/mordil/redistack/1.3.2/documentation/redistack/redisclient)。
|
||||||
|
|
||||||
对于各别的 [Redis 命令](https://redis.io/commands),`RedisClient` 都有其对应的扩展。
|
对于各别的 [Redis 命令](https://redis.io/commands),`RedisClient` 都有其对应的扩展。
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
Redis can act as a storage provider for caching [session data](../advanced/sessions.md#session-data) such as user credentials.
|
Redis can act as a storage provider for caching [session data](../advanced/sessions.md#session-data) such as user credentials.
|
||||||
|
|
||||||
If a custom [`RedisSessionsDelegate`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/) isn't provided, a default will be used.
|
If a custom [`RedisSessionsDelegate`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate) isn't provided, a default will be used.
|
||||||
|
|
||||||
## Default Behavior
|
## Default Behavior
|
||||||
|
|
||||||
### SessionID Creation
|
### SessionID Creation
|
||||||
|
|
||||||
Unless you implement the [`makeNewID()`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.makeNewID()) method in [your own `RedisSessionsDelegate`](#redissessionsdelegate), all [`SessionID`](https://api.vapor.codes/vapor/main/Vapor/SessionID/) values will be created by doing the following:
|
Unless you implement the [`makeNewID()`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/makenewid()-3hyne) method in [your own `RedisSessionsDelegate`](#redissessionsdelegate), all [`SessionID`](https://api.vapor.codes/vapor/documentation/vapor/sessionid) values will be created by doing the following:
|
||||||
|
|
||||||
1. Generate 32 bytes of random characters
|
1. Generate 32 bytes of random characters
|
||||||
1. base64 encode the value
|
1. base64 encode the value
|
||||||
|
|
@ -17,9 +17,9 @@ For example: `Hbxozx8rTj+XXGWAzOhh1npZFXaGLpTWpWCaXuo44xQ=`
|
||||||
|
|
||||||
### SessionData Storage
|
### SessionData Storage
|
||||||
|
|
||||||
The default implementation of `RedisSessionsDelegate` will store [`SessionData`](https://api.vapor.codes/vapor/main/Vapor/SessionData/) as a simple JSON string value using `Codable`.
|
The default implementation of `RedisSessionsDelegate` will store [`SessionData`](https://api.vapor.codes/vapor/documentation/vapor/sessiondata) as a simple JSON string value using `Codable`.
|
||||||
|
|
||||||
Unless you implement the [`makeRedisKey(for:)`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.makeRedisKey(for:)) method in your own `RedisSessionsDelegate`, `SessionData` will be stored in Redis with a key that prefixes the `SessionID` with `vrs-` (**V**apor **R**edis **S**essions)
|
Unless you implement the [`makeRedisKey(for:)`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/makerediskey(for:)-5nfge) method in your own `RedisSessionsDelegate`, `SessionData` will be stored in Redis with a key that prefixes the `SessionID` with `vrs-` (**V**apor **R**edis **S**essions)
|
||||||
|
|
||||||
For example: `vrs-Hbxozx8rTj+XXGWAzOhh1npZFXaGLpTWpWCaXuo44xQ=`
|
For example: `vrs-Hbxozx8rTj+XXGWAzOhh1npZFXaGLpTWpWCaXuo44xQ=`
|
||||||
|
|
||||||
|
|
@ -39,11 +39,11 @@ app.sessions.use(.redis(delegate: CustomRedisSessionsDelegate()))
|
||||||
|
|
||||||
## RedisSessionsDelegate
|
## RedisSessionsDelegate
|
||||||
|
|
||||||
> API Documentation: [`RedisSessionsDelegate`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/)
|
> API Documentation: [`RedisSessionsDelegate`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate)
|
||||||
|
|
||||||
An object that conforms to this protocol can be used to change how `SessionData` is stored in Redis.
|
An object that conforms to this protocol can be used to change how `SessionData` is stored in Redis.
|
||||||
|
|
||||||
Only two methods are required to be implemented by a type conforming to the protocol: [`redis(_:store:with:)`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.redis(_:store:with:)) and [`redis(_:fetchDataFor:)`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.redis(_:fetchDataFor:)).
|
Only two methods are required to be implemented by a type conforming to the protocol: [`redis(_:store:with:)`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/redis(_:store:with:)) and [`redis(_:fetchDataFor:)`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/redis(_:fetchdatafor:)).
|
||||||
|
|
||||||
Both are required, as the way you customize writing the session data to Redis is intrinsically linked to how it is to be read from Redis.
|
Both are required, as the way you customize writing the session data to Redis is intrinsically linked to how it is to be read from Redis.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
Redis kan fungeren als een opslagprovider voor het cachen van [sessie-gegevens](../advanced/sessions.md#session-data) zoals gebruikersgegevens.
|
Redis kan fungeren als een opslagprovider voor het cachen van [sessie-gegevens](../advanced/sessions.md#session-data) zoals gebruikersgegevens.
|
||||||
|
|
||||||
Als er geen aangepaste [`RedisSessionsDelegate`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/) is opgegeven, zal er een standaard worden gebruikt.
|
Als er geen aangepaste [`RedisSessionsDelegate`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate) is opgegeven, zal er een standaard worden gebruikt.
|
||||||
|
|
||||||
## Standaard Gedrag
|
## Standaard Gedrag
|
||||||
|
|
||||||
### SessionID Creatie
|
### SessionID Creatie
|
||||||
|
|
||||||
Tenzij je de [`makeNewID()`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.makeNewID()) methode implementeert in [je eigen `RedisSessionsDelegate`](#RedisSessionsDelegate), zullen alle [`SessionID`](https://api.vapor.codes/vapor/main/Vapor/SessionID/) waarden aangemaakt worden door het volgende te doen:
|
Tenzij je de [`makeNewID()`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/makenewid()-3hyne) methode implementeert in [je eigen `RedisSessionsDelegate`](#RedisSessionsDelegate), zullen alle [`SessionID`](https://api.vapor.codes/vapor/documentation/vapor/sessionid) waarden aangemaakt worden door het volgende te doen:
|
||||||
|
|
||||||
1. Genereer 32 bytes van willekeurige tekens
|
1. Genereer 32 bytes van willekeurige tekens
|
||||||
2. base64 codeer de waarde
|
2. base64 codeer de waarde
|
||||||
|
|
@ -17,9 +17,9 @@ Bijvoorbeeld: `Hbxozx8rTj+XXGWAzOhh1npZFXaGLpTWpWCaXuo44xQ=`
|
||||||
|
|
||||||
### SessionData Opslag
|
### SessionData Opslag
|
||||||
|
|
||||||
De standaard implementatie van `RedisSessionsDelegate` slaat [`SessionData`](https://api.vapor.codes/vapor/main/Vapor/SessionData/) op als een eenvoudige JSON string waarde met behulp van `Codable`.
|
De standaard implementatie van `RedisSessionsDelegate` slaat [`SessionData`](https://api.vapor.codes/vapor/documentation/vapor/sessiondata) op als een eenvoudige JSON string waarde met behulp van `Codable`.
|
||||||
|
|
||||||
Tenzij u de [`makeRedisKey(for:)`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.makeRedisKey(for:)) methode implementeert in uw eigen `RedisSessionsDelegate`, zal `SessionData` worden opgeslagen in Redis met een sleutel die de `SessionID` voorvoegt met `vrs-` (**V**apor **R**edis **S**essions)
|
Tenzij u de [`makeRedisKey(for:)`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/makerediskey(for:)-5nfge) methode implementeert in uw eigen `RedisSessionsDelegate`, zal `SessionData` worden opgeslagen in Redis met een sleutel die de `SessionID` voorvoegt met `vrs-` (**V**apor **R**edis **S**essions)
|
||||||
|
|
||||||
Bijvoorbeeld: `vrs-Hbxozx8rTj+XXGWAzOhh1npZFXaGLpTWpWCaXuo44xQ=`
|
Bijvoorbeeld: `vrs-Hbxozx8rTj+XXGWAzOhh1npZFXaGLpTWpWCaXuo44xQ=`
|
||||||
|
|
||||||
|
|
@ -39,11 +39,11 @@ app.sessions.use(.redis(delegate: CustomRedisSessionsDelegate()))
|
||||||
|
|
||||||
## RedisSessionsDelegate
|
## RedisSessionsDelegate
|
||||||
|
|
||||||
> API Documentatie: [`RedisSessionsDelegate`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/)
|
> API Documentatie: [`RedisSessionsDelegate`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate)
|
||||||
|
|
||||||
Een object dat voldoet aan dit protocol kan worden gebruikt om te veranderen hoe `SessionData` wordt opgeslagen in Redis.
|
Een object dat voldoet aan dit protocol kan worden gebruikt om te veranderen hoe `SessionData` wordt opgeslagen in Redis.
|
||||||
|
|
||||||
Slechts twee methoden hoeven te worden geïmplementeerd door een type dat voldoet aan het protocol: [`redis(_:store:with:)`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.redis(_:store:with:)) en [`redis(_:fetchDataFor:)`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.redis(_:fetchDataFor:)).
|
Slechts twee methoden hoeven te worden geïmplementeerd door een type dat voldoet aan het protocol: [`redis(_:store:with:)`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/redis(_:store:with:)) en [`redis(_:fetchDataFor:)`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/redis(_:fetchdatafor:)).
|
||||||
|
|
||||||
Beide zijn nodig, want de manier waarop u de sessiegegevens naar Redis schrijft, is intrinsiek verbonden met de manier waarop ze uit Redis moeten worden gelezen.
|
Beide zijn nodig, want de manier waarop u de sessiegegevens naar Redis schrijft, is intrinsiek verbonden met de manier waarop ze uit Redis moeten worden gelezen.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
Redis 可以作为一个存储提供程序,用于缓存[会话数据](../advanced/sessions.md#session-data),例如用户凭据。
|
Redis 可以作为一个存储提供程序,用于缓存[会话数据](../advanced/sessions.md#session-data),例如用户凭据。
|
||||||
|
|
||||||
如果 [`RedisSessionsDelegate`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/) 未提供自定义委托,则将使用默认值。
|
如果 [`RedisSessionsDelegate`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate) 未提供自定义委托,则将使用默认值。
|
||||||
|
|
||||||
## 默认行为
|
## 默认行为
|
||||||
|
|
||||||
### 创建 SessionID
|
### 创建 SessionID
|
||||||
|
|
||||||
除非在你自己的 [`RedisSessionsDelegate`](#redissessionsdelegate) 中实现 [`makeNewID()`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.makeNewID()) 方法,否则所有的 ['SessionID`](https://api.vapor.codes/vapor/main/Vapor/SessionID/) 值将通过以下操作创建:
|
除非在你自己的 [`RedisSessionsDelegate`](#redissessionsdelegate) 中实现 [`makeNewID()`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/makenewid()-3hyne) 方法,否则所有的 ['SessionID`](https://api.vapor.codes/vapor/documentation/vapor/sessionid) 值将通过以下操作创建:
|
||||||
|
|
||||||
1. 生成32字节的随机字符
|
1. 生成32字节的随机字符
|
||||||
1. base64 编码该值
|
1. base64 编码该值
|
||||||
|
|
@ -17,9 +17,9 @@ Redis 可以作为一个存储提供程序,用于缓存[会话数据](../advan
|
||||||
|
|
||||||
### 存储会话数据
|
### 存储会话数据
|
||||||
|
|
||||||
`RedisSessionsDelegate` 的默认实现将使用 `Codable` 将 [`SessionData`](https://api.vapor.codes/vapor/main/Vapor/SessionData/) 存储为一个简单的JSON字符串值。
|
`RedisSessionsDelegate` 的默认实现将使用 `Codable` 将 [`SessionData`](https://api.vapor.codes/vapor/documentation/vapor/sessiondata) 存储为一个简单的JSON字符串值。
|
||||||
|
|
||||||
除非在你自己的 `RedisSessionsDelegate` 中实现了 [`makeRedisKey(for:)`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.makeRedisKey(for:)) 方法,`SessionData` 将存储在 Redis 中,其中的键会在 `SessionID` 前加上前缀 `vrs-` (**V**apor **R**edis **S**essions)。
|
除非在你自己的 `RedisSessionsDelegate` 中实现了 [`makeRedisKey(for:)`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/makerediskey(for:)-5nfge) 方法,`SessionData` 将存储在 Redis 中,其中的键会在 `SessionID` 前加上前缀 `vrs-` (**V**apor **R**edis **S**essions)。
|
||||||
|
|
||||||
例如:`vrs-Hbxozx8rTj+XXGWAzOhh1npZFXaGLpTWpWCaXuo44xQ=`
|
例如:`vrs-Hbxozx8rTj+XXGWAzOhh1npZFXaGLpTWpWCaXuo44xQ=`
|
||||||
|
|
||||||
|
|
@ -39,11 +39,11 @@ app.sessions.use(.redis(delegate: CustomRedisSessionsDelegate()))
|
||||||
|
|
||||||
## RedisSessionsDelegate
|
## RedisSessionsDelegate
|
||||||
|
|
||||||
> API 文档:[`RedisSessionsDelegate`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/)
|
> API 文档:[`RedisSessionsDelegate`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate)
|
||||||
|
|
||||||
遵循该协议的对象可以用来改变 `SessionData` 在 Redis 中的存储方式。
|
遵循该协议的对象可以用来改变 `SessionData` 在 Redis 中的存储方式。
|
||||||
|
|
||||||
符合协议的类型只需要实现两个方法:[`redis(_:store:with:)`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.redis(_:store:with:)) 和 [`redis(_:fetchDataFor:)`](https://api.vapor.codes/redis/main/Redis/RedisSessionsDelegate/#redissessionsdelegate.redis(_:fetchDataFor:))
|
符合协议的类型只需要实现两个方法:[`redis(_:store:with:)`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/redis(_:store:with:)) 和 [`redis(_:fetchDataFor:)`](https://api.vapor.codes/redis/documentation/redis/redissessionsdelegate/redis(_:fetchdatafor:))
|
||||||
|
|
||||||
这两者都是必需的,因为你自定义写入会话数据到 Redis 的方式本质上是与如何从 Redis 读取它有内在联系。
|
这两者都是必需的,因为你自定义写入会话数据到 Redis 的方式本质上是与如何从 Redis 读取它有内在联系。
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -347,7 +347,7 @@ Vapor 3's global `flatMap` method for combining multiple futures is no longer av
|
||||||
|
|
||||||
### ByteBuffer
|
### ByteBuffer
|
||||||
|
|
||||||
Many methods and properties that previously used `Data` now use NIO's `ByteBuffer`. This type is a more powerful and performant byte storage type. You can read more about its API in [SwiftNIO's ByteBuffer docs](https://apple.github.io/swift-nio/docs/current/NIOCore/Structs/ByteBuffer.html).
|
Many methods and properties that previously used `Data` now use NIO's `ByteBuffer`. This type is a more powerful and performant byte storage type. You can read more about its API in [SwiftNIO's ByteBuffer docs](https://swiftpackageindex.com/apple/swift-nio/main/documentation/niocore/bytebuffer).
|
||||||
|
|
||||||
To convert a `ByteBuffer` back to `Data`, use:
|
To convert a `ByteBuffer` back to `Data`, use:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -349,7 +349,7 @@ Vapor 3's globale `flatMap` methode voor het combineren van meerdere futures is
|
||||||
|
|
||||||
### ByteBuffer
|
### ByteBuffer
|
||||||
|
|
||||||
Veel methoden en eigenschappen die voorheen `Data` gebruikten, gebruiken nu NIO's `ByteBuffer`. Dit type is een krachtiger en performanter byte opslagtype. U kunt meer lezen over de API in [SwiftNIO's ByteBuffer docs](https://apple.github.io/swift-nio/docs/current/NIOCore/Structs/ByteBuffer.html).
|
Veel methoden en eigenschappen die voorheen `Data` gebruikten, gebruiken nu NIO's `ByteBuffer`. Dit type is een krachtiger en performanter byte opslagtype. U kunt meer lezen over de API in [SwiftNIO's ByteBuffer docs](https://swiftpackageindex.com/apple/swift-nio/main/documentation/niocore/bytebuffer).
|
||||||
|
|
||||||
Om een `ByteBuffer` terug te converteren naar `Data`, gebruik je:
|
Om een `ByteBuffer` terug te converteren naar `Data`, gebruik je:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue