Refactor(core): Reverts Inclusion of constraint graph for merchant Payment Method list (#4839)

This commit is contained in:
Prajjwal Kumar
2024-05-31 18:31:50 +05:30
committed by GitHub
parent 5cb84f66e4
commit f74b9b622e
7 changed files with 471 additions and 1097 deletions

View File

@ -31,9 +31,6 @@ const ROUTING_CACHE_PREFIX: &str = "routing";
/// Prefix for cgraph cache key
const CGRAPH_CACHE_PREFIX: &str = "cgraph";
/// Prefix for PM Filter cgraph cache key
const PM_FILTERS_CGRAPH_CACHE_PREFIX: &str = "pm_filters_cgraph";
/// Prefix for all kinds of cache key
const ALL_CACHE_PREFIX: &str = "all_cache_kind";
@ -61,10 +58,6 @@ pub static ROUTING_CACHE: Lazy<Cache> =
pub static CGRAPH_CACHE: Lazy<Cache> =
Lazy::new(|| Cache::new(CACHE_TTL, CACHE_TTI, Some(MAX_CAPACITY)));
/// PM Filter CGraph Cache
pub static PM_FILTERS_CGRAPH_CACHE: Lazy<Cache> =
Lazy::new(|| Cache::new(CACHE_TTL, CACHE_TTI, Some(MAX_CAPACITY)));
/// Trait which defines the behaviour of types that's gonna be stored in Cache
pub trait Cacheable: Any + Send + Sync + DynClone {
fn as_any(&self) -> &dyn Any;
@ -75,7 +68,6 @@ pub enum CacheKind<'a> {
Accounts(Cow<'a, str>),
Routing(Cow<'a, str>),
CGraph(Cow<'a, str>),
PmFiltersCGraph(Cow<'a, str>),
All(Cow<'a, str>),
}
@ -86,7 +78,6 @@ impl<'a> From<CacheKind<'a>> for RedisValue {
CacheKind::Accounts(s) => format!("{ACCOUNTS_CACHE_PREFIX},{s}"),
CacheKind::Routing(s) => format!("{ROUTING_CACHE_PREFIX},{s}"),
CacheKind::CGraph(s) => format!("{CGRAPH_CACHE_PREFIX},{s}"),
CacheKind::PmFiltersCGraph(s) => format!("{PM_FILTERS_CGRAPH_CACHE_PREFIX},{s}"),
CacheKind::All(s) => format!("{ALL_CACHE_PREFIX},{s}"),
};
Self::from_string(value)
@ -106,9 +97,6 @@ impl<'a> TryFrom<RedisValue> for CacheKind<'a> {
CONFIG_CACHE_PREFIX => Ok(Self::Config(Cow::Owned(split.1.to_string()))),
ROUTING_CACHE_PREFIX => Ok(Self::Routing(Cow::Owned(split.1.to_string()))),
CGRAPH_CACHE_PREFIX => Ok(Self::CGraph(Cow::Owned(split.1.to_string()))),
PM_FILTERS_CGRAPH_CACHE_PREFIX => {
Ok(Self::PmFiltersCGraph(Cow::Owned(split.1.to_string())))
}
ALL_CACHE_PREFIX => Ok(Self::All(Cow::Owned(split.1.to_string()))),
_ => Err(validation_err.into()),
}

View File

@ -2,9 +2,7 @@ use error_stack::ResultExt;
use redis_interface::{errors as redis_errors, PubsubInterface, RedisValue};
use router_env::{logger, tracing::Instrument};
use crate::redis::cache::{
CacheKind, ACCOUNTS_CACHE, CGRAPH_CACHE, CONFIG_CACHE, PM_FILTERS_CGRAPH_CACHE, ROUTING_CACHE,
};
use crate::redis::cache::{CacheKind, ACCOUNTS_CACHE, CGRAPH_CACHE, CONFIG_CACHE, ROUTING_CACHE};
#[async_trait::async_trait]
pub trait PubSubInterface {
@ -84,10 +82,6 @@ impl PubSubInterface for std::sync::Arc<redis_interface::RedisConnectionPool> {
CGRAPH_CACHE.remove(key.as_ref()).await;
key
}
CacheKind::PmFiltersCGraph(key) => {
PM_FILTERS_CGRAPH_CACHE.remove(key.as_ref()).await;
key
}
CacheKind::Routing(key) => {
ROUTING_CACHE.remove(key.as_ref()).await;
key
@ -96,7 +90,6 @@ impl PubSubInterface for std::sync::Arc<redis_interface::RedisConnectionPool> {
CONFIG_CACHE.remove(key.as_ref()).await;
ACCOUNTS_CACHE.remove(key.as_ref()).await;
CGRAPH_CACHE.remove(key.as_ref()).await;
PM_FILTERS_CGRAPH_CACHE.remove(key.as_ref()).await;
ROUTING_CACHE.remove(key.as_ref()).await;
key
}