mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
Refactor(core): reverts the payment method list filtering using constraint graph (#5044)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -41,9 +41,6 @@ const SURCHARGE_CACHE_PREFIX: &str = "surcharge";
|
||||
/// 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";
|
||||
|
||||
@ -86,16 +83,6 @@ pub static SURCHARGE_CACHE: Lazy<Cache> =
|
||||
pub static CGRAPH_CACHE: Lazy<Cache> =
|
||||
Lazy::new(|| Cache::new("CGRAPH_CACHE", CACHE_TTL, CACHE_TTI, Some(MAX_CAPACITY)));
|
||||
|
||||
/// PM Filter CGraph Cache
|
||||
pub static PM_FILTERS_CGRAPH_CACHE: Lazy<Cache> = Lazy::new(|| {
|
||||
Cache::new(
|
||||
"PM_FILTERS_CGRAPH_CACHE",
|
||||
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;
|
||||
@ -108,7 +95,6 @@ pub enum CacheKind<'a> {
|
||||
DecisionManager(Cow<'a, str>),
|
||||
Surcharge(Cow<'a, str>),
|
||||
CGraph(Cow<'a, str>),
|
||||
PmFiltersCGraph(Cow<'a, str>),
|
||||
All(Cow<'a, str>),
|
||||
}
|
||||
|
||||
@ -121,7 +107,6 @@ impl<'a> From<CacheKind<'a>> for RedisValue {
|
||||
CacheKind::DecisionManager(s) => format!("{DECISION_MANAGER_CACHE_PREFIX},{s}"),
|
||||
CacheKind::Surcharge(s) => format!("{SURCHARGE_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)
|
||||
@ -145,10 +130,6 @@ impl<'a> TryFrom<RedisValue> for CacheKind<'a> {
|
||||
}
|
||||
SURCHARGE_CACHE_PREFIX => Ok(Self::Surcharge(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()),
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ use router_env::{logger, tracing::Instrument};
|
||||
|
||||
use crate::redis::cache::{
|
||||
CacheKey, CacheKind, ACCOUNTS_CACHE, CGRAPH_CACHE, CONFIG_CACHE, DECISION_MANAGER_CACHE,
|
||||
PM_FILTERS_CGRAPH_CACHE, ROUTING_CACHE, SURCHARGE_CACHE,
|
||||
ROUTING_CACHE, SURCHARGE_CACHE,
|
||||
};
|
||||
|
||||
#[async_trait::async_trait]
|
||||
@ -100,16 +100,6 @@ impl PubSubInterface for std::sync::Arc<redis_interface::RedisConnectionPool> {
|
||||
.await;
|
||||
key
|
||||
}
|
||||
CacheKind::PmFiltersCGraph(key) => {
|
||||
PM_FILTERS_CGRAPH_CACHE
|
||||
.remove(CacheKey {
|
||||
key: key.to_string(),
|
||||
prefix: self.key_prefix.clone(),
|
||||
})
|
||||
.await;
|
||||
|
||||
key
|
||||
}
|
||||
CacheKind::Routing(key) => {
|
||||
ROUTING_CACHE
|
||||
.remove(CacheKey {
|
||||
@ -156,12 +146,6 @@ impl PubSubInterface for std::sync::Arc<redis_interface::RedisConnectionPool> {
|
||||
prefix: self.key_prefix.clone(),
|
||||
})
|
||||
.await;
|
||||
PM_FILTERS_CGRAPH_CACHE
|
||||
.remove(CacheKey {
|
||||
key: key.to_string(),
|
||||
prefix: self.key_prefix.clone(),
|
||||
})
|
||||
.await;
|
||||
ROUTING_CACHE
|
||||
.remove(CacheKey {
|
||||
key: key.to_string(),
|
||||
|
||||
Reference in New Issue
Block a user