refactor(conditional_configs): refactor conditional_configs to use Moka Cache instead of Static Cache (#4814)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Amisha Prabhat
2024-06-11 13:17:25 +05:30
committed by GitHub
parent 2119de9c1e
commit 4d0c89362a
13 changed files with 180 additions and 171 deletions

View File

@ -188,6 +188,7 @@ pub async fn update_routing_algorithm(
pub async fn update_merchant_active_algorithm_ref(
db: &dyn StorageInterface,
key_store: &domain::MerchantKeyStore,
config_key: cache::CacheKind<'_>,
algorithm_id: routing_types::RoutingAlgorithmRef,
) -> RouterResult<()> {
let ref_value = algorithm_id
@ -226,6 +227,11 @@ pub async fn update_merchant_active_algorithm_ref(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to update routing algorithm ref in merchant account")?;
cache::publish_into_redact_channel(db.get_cache_store().as_ref(), [config_key])
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to invalidate the config cache")?;
Ok(())
}