Skip to content

Commit 8ceb692

Browse files
Fix RedisDemo: update RedisKey
1 parent bb7f4e8 commit 8ceb692

File tree

2 files changed

+93
-4
lines changed

2 files changed

+93
-4
lines changed

Examples/RedisDemo/Package.resolved

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"object": {
3+
"pins": [
4+
{
5+
"package": "async-http-client",
6+
"repositoryURL": "https://github.com/swift-server/async-http-client.git",
7+
"state": {
8+
"branch": null,
9+
"revision": "e2636a4c24e646d3e480fc666da0c090818beb09",
10+
"version": "1.1.0"
11+
}
12+
},
13+
{
14+
"package": "LambdaSwiftSprinter",
15+
"repositoryURL": "https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core",
16+
"state": {
17+
"branch": null,
18+
"revision": "6941e41194bde0e57fb0deb23be620f2b8dd626d",
19+
"version": "1.0.0"
20+
}
21+
},
22+
{
23+
"package": "LambdaSwiftSprinterNioPlugin",
24+
"repositoryURL": "https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin",
25+
"state": {
26+
"branch": null,
27+
"revision": "35d3ab84bf83fc881844b5f7483cb2a1d942a23f",
28+
"version": "1.0.1"
29+
}
30+
},
31+
{
32+
"package": "swift-log",
33+
"repositoryURL": "https://github.com/apple/swift-log.git",
34+
"state": {
35+
"branch": null,
36+
"revision": "74d7b91ceebc85daf387ebb206003f78813f71aa",
37+
"version": "1.2.0"
38+
}
39+
},
40+
{
41+
"package": "swift-metrics",
42+
"repositoryURL": "https://github.com/apple/swift-metrics.git",
43+
"state": {
44+
"branch": null,
45+
"revision": "708b960b4605abb20bc55d65abf6bad607252200",
46+
"version": "2.0.0"
47+
}
48+
},
49+
{
50+
"package": "swift-nio",
51+
"repositoryURL": "https://github.com/apple/swift-nio.git",
52+
"state": {
53+
"branch": null,
54+
"revision": "a27a07719ca785bcaca019a5b9fe1814b981b4a2",
55+
"version": "2.15.0"
56+
}
57+
},
58+
{
59+
"package": "swift-nio-extras",
60+
"repositoryURL": "https://github.com/apple/swift-nio-extras.git",
61+
"state": {
62+
"branch": null,
63+
"revision": "b4dbfacff47fb8d0f9e0a422d8d37935a9f10570",
64+
"version": "1.4.0"
65+
}
66+
},
67+
{
68+
"package": "swift-nio-ssl",
69+
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
70+
"state": {
71+
"branch": null,
72+
"revision": "af46d9b58fafbb76f9b01177568d435a1b024f99",
73+
"version": "2.6.2"
74+
}
75+
},
76+
{
77+
"package": "RediStack",
78+
"repositoryURL": "https://gitlab.com/mordil/swift-redi-stack.git",
79+
"state": {
80+
"branch": null,
81+
"revision": "b08ad5461af53276020a21c7fa66fa1237eea723",
82+
"version": "1.0.0-alpha.8"
83+
}
84+
}
85+
]
86+
},
87+
"version": 1
88+
}

Examples/RedisDemo/Sources/RedisDemo/main.swift

+5-4
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ let connection = try? RedisConnection.connect(
5252

5353
let syncCodableNIOLambda: SyncCodableNIOLambda<Event, Response> = { (event, context) throws -> EventLoopFuture<Response> in
5454

55-
guard let connection = connection else {
55+
guard let connection = connection,
56+
let key = RedisKey(rawValue: event.key) else {
5657
throw LambdaError.redisConnectionFailed
5758
}
5859

59-
let future = connection.set(event.key, to: event.value)
60-
.flatMap {
61-
return connection.get(event.key)
60+
let future = connection.set(key, to: event.value)
61+
.flatMap { _ in
62+
return connection.get(key)
6263
}
6364
.map { content -> Response in
6465
return Response(value: content ?? "")

0 commit comments

Comments
 (0)