Commit 9761d374 authored by Shiv Singh's avatar Shiv Singh
Browse files

[+] added basic structure for RedisAzureCache

parent e367baae
Pipeline #100158 failed with stages
in 8 seconds
......@@ -14,7 +14,8 @@
package org.opengroup.osdu.storage.provider.azure.cache;
import org.opengroup.osdu.core.common.cache.RedisCache;
import org.opengroup.osdu.azure.cache.RedisAzureCache;
import org.opengroup.osdu.azure.di.RedisAzureConfiguration;
import org.opengroup.osdu.core.common.model.entitlements.Groups;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
......@@ -24,15 +25,14 @@ import javax.inject.Named;
@Component
@ConditionalOnProperty(value = "runtime.env.local", havingValue = "false", matchIfMissing = true)
public class GroupRedisCache extends RedisCache<String, Groups> {
public class GroupRedisCache extends RedisAzureCache<String, Groups> {
public GroupRedisCache(
final @Named("REDIS_HOST") String host,
final @Named("REDIS_PORT") int port,
final @Named("REDIS_PASSWORD") String password,
final @Named("GROUP_REDIS_TTL") int timeout,
final @Named("REDIS_EXPIRATION") int expiration,
@Value("${redis.database}") final int database)
{
super(host, port, password, timeout, database, String.class, Groups.class);
super(String.class, Groups.class, new RedisAzureConfiguration(database, expiration, port, timeout));
}
}
\ No newline at end of file
......@@ -14,7 +14,8 @@
package org.opengroup.osdu.storage.provider.azure.cache;
import org.opengroup.osdu.core.common.cache.RedisCache;
import org.opengroup.osdu.azure.di.RedisAzureConfiguration;
import org.opengroup.osdu.azure.cache.RedisAzureCache;
import org.opengroup.osdu.core.common.model.storage.Schema;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
......@@ -24,15 +25,14 @@ import javax.inject.Named;
@Component
@ConditionalOnProperty(value = "runtime.env.local", havingValue = "false", matchIfMissing = true)
public class SchemaRedisCache extends RedisCache<String, Schema> {
public class SchemaRedisCache extends RedisAzureCache<String, Schema> {
public SchemaRedisCache(
final @Named("REDIS_HOST") String host,
final @Named("REDIS_PORT") int port,
final @Named("REDIS_PASSWORD") String password,
final @Named("SCHEMA_REDIS_TTL") int timeout,
final @Named("REDIS_EXPIRATION") int expiration,
@Value("${redis.database}") final int database)
{
super(host, port, password, timeout, database, String.class, Schema.class);
super(String.class, Schema.class, new RedisAzureConfiguration(database, expiration, port, timeout));
}
}
\ No newline at end of file
......@@ -20,6 +20,9 @@ public class RedisConfig {
@Value("${redis.group.ttl:30}")
public int groupRedisTtl;
@Value("${redis.expiration:3600}")
public int redisExpiration;
@Bean
@Named("REDIS_PORT")
public int getRedisPort() {
......@@ -37,12 +40,6 @@ public class RedisConfig {
public int getGroupRedisTtl() { return groupRedisTtl; }
@Bean
@Named("REDIS_HOST")
public String redisHost(SecretClient kv) {
return KeyVaultFacade.getSecretWithValidation(kv, "redis-hostname");
}
@Bean
@Named("REDIS_PASSWORD")
public String redisPassword(SecretClient kv) { return KeyVaultFacade.getSecretWithValidation(kv, "redis-password"); }
@Named("REDIS_EXPIRATION")
public int getRedisExpiration() { return redisExpiration; }
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment