File tree 3 files changed +19
-6
lines changed
3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 1
- HOST_NAME = " "
2
1
USER_NAME = " "
3
2
PASSWD = " "
Original file line number Diff line number Diff line change 1
1
using Microsoft . AspNetCore . Mvc ;
2
-
2
+ using StackExchange . Redis ;
3
3
4
4
public class ZonesController : ControllerBase
5
5
{
6
- [ HttpGet ( "{keepIn}" ) ]
6
+ private ConnectionMultiplexer redis = ConnectionMultiplexer . Connect ( "localhost" ) ;
7
+ private readonly IDatabase _redis ;
8
+
9
+ public ZonesController ( ) {
10
+ _redis = redis . GetDatabase ( ) ;
11
+ }
12
+
13
+ [ HttpGet ( "zones/{keepIn}" ) ]
7
14
public String getZones ( string keepIn ) {
8
15
if ( keepIn . ToLower ( ) == "in" ) {
9
16
// return keep-in zones
10
- return "in" ;
17
+ return _redis . StringGet ( "keepIn" ) ;
11
18
}
12
19
13
20
// else return keep-out zones
14
- return "out" ;
21
+ if ( keepIn . ToLower ( ) == "out" ) {
22
+ // return keep-in zones
23
+ return _redis . StringGet ( "keepOut" ) ;
24
+ }
25
+
26
+ return "invalid zone name" ;
15
27
}
28
+
29
+
16
30
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ services:
11
11
redis-commander :
12
12
image : rediscommander/redis-commander:latest
13
13
environment :
14
- - REDIS_HOSTS=${HOST_NAME:?error}
14
+ - REDIS_HOSTS=local:redis:6379
15
15
- HTTP_USER=${USER_NAME:?error}
16
16
- HTTP_PASSWORD=${PASSWD:?error}
17
17
ports :
You can’t perform that action at this time.
0 commit comments