Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
Partition
Commits
213326fd
Commit
213326fd
authored
Apr 30, 2021
by
Kelly Zhou
Committed by
Mingyang Zhu
May 18, 2021
Browse files
add clientOprtions to redis cache construction
parent
3672fc12
Changes
1
Hide whitespace changes
Inline
Side-by-side
provider/partition-azure/src/main/java/org/opengroup/osdu/partition/provider/azure/di/RedisConfig.java
View file @
213326fd
package
org.opengroup.osdu.partition.provider.azure.di
;
import
com.azure.security.keyvault.secrets.SecretClient
;
import
com.lambdaworks.redis.ClientOptions
;
import
com.lambdaworks.redis.SocketOptions
;
import
org.opengroup.osdu.azure.KeyVaultFacade
;
import
org.opengroup.osdu.core.common.cache.RedisCache
;
import
org.opengroup.osdu.partition.model.PartitionInfo
;
...
...
@@ -11,6 +13,7 @@ import org.springframework.context.annotation.Configuration;
import
javax.inject.Named
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
@Configuration
public
class
RedisConfig
{
...
...
@@ -42,12 +45,18 @@ public class RedisConfig {
@Bean
public
RedisCache
<
String
,
PartitionInfo
>
partitionServiceCache
(
@Named
(
"REDIS_HOST"
)
String
host
,
@Named
(
"REDIS_PASSWORD"
)
String
password
)
{
return
new
RedisCache
<>(
host
,
port
,
password
,
expiration
,
database
,
String
.
class
,
PartitionInfo
.
class
);
ClientOptions
clientOptions
=
ClientOptions
.
builder
()
.
socketOptions
(
SocketOptions
.
builder
().
connectTimeout
(
15
,
TimeUnit
.
SECONDS
).
build
())
.
build
();
return
new
RedisCache
<>(
host
,
port
,
password
,
expiration
,
database
,
clientOptions
,
String
.
class
,
PartitionInfo
.
class
);
}
@Bean
public
RedisCache
<
String
,
List
<
String
>>
partitionListCache
(
@Named
(
"REDIS_HOST"
)
String
host
,
@Named
(
"REDIS_PASSWORD"
)
String
password
)
{
return
new
RedisCache
(
host
,
port
,
password
,
expiration
,
database
,
String
.
class
,
List
.
class
);
ClientOptions
clientOptions
=
ClientOptions
.
builder
()
.
socketOptions
(
SocketOptions
.
builder
().
connectTimeout
(
15
,
TimeUnit
.
SECONDS
).
build
())
.
build
();
return
new
RedisCache
(
host
,
port
,
password
,
expiration
,
database
,
clientOptions
,
String
.
class
,
List
.
class
);
}
}
...
...
@@ -67,12 +76,18 @@ public class RedisConfig {
@Bean
public
RedisCache
<
String
,
PartitionInfo
>
partitionServiceCache
(
@Named
(
"REDIS_HOST"
)
String
host
)
{
return
new
RedisCache
<>(
host
,
port
,
expiration
,
database
,
String
.
class
,
PartitionInfo
.
class
);
ClientOptions
clientOptions
=
ClientOptions
.
builder
()
.
socketOptions
(
SocketOptions
.
builder
().
connectTimeout
(
15
,
TimeUnit
.
SECONDS
).
build
())
.
build
();
return
new
RedisCache
<>(
host
,
port
,
expiration
,
database
,
clientOptions
,
String
.
class
,
PartitionInfo
.
class
);
}
@Bean
public
RedisCache
<
String
,
List
<
String
>>
partitionListCache
(
@Named
(
"REDIS_HOST"
)
String
host
)
{
return
new
RedisCache
(
host
,
port
,
expiration
,
database
,
String
.
class
,
List
.
class
);
ClientOptions
clientOptions
=
ClientOptions
.
builder
()
.
socketOptions
(
SocketOptions
.
builder
().
connectTimeout
(
15
,
TimeUnit
.
SECONDS
).
build
())
.
build
();
return
new
RedisCache
(
host
,
port
,
expiration
,
database
,
clientOptions
,
String
.
class
,
List
.
class
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment