Issue:
Bug: Standardize Redis Key Prefix for User Lineage Context



Currently, the lineage context is cached in Redis using tenant-specific key prefixes (public_, public_v2_). This causes inconsistencies across V1 and V2 environments — especially during login/logout flows — as lineage context data becomes deployment-specific.


Need to introduce a new Redis connection helper that overrides the prefix with the global value from config (global). 

Pull request description:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
This PR updates the lineage context Redis caching logic to use a dedicated global Redis key prefix (`global`) instead of the default tenant-scoped prefixes (`public_`, `public_v2_`), causing inconsistencies between deployments (i.e., v1 and v2).

Introduced a new helper: `get_redis_connection_for_global_tenant`
  - Fetches Redis connection with `key_prefix` set to `global`.
- Updated lineage context caching (`get_lineage_context_from_cache`, `set_lineage_context_in_cache`) to use the global Redis connection

This will enable [https://github.com/juspay/hyperswitch/pull/7871](https://github.com/juspay/hyperswitch/pull/7871) to work with both v1 and v2 merchant accounts.

The redis-key should now be in the format of global:LINEAGE_CONTEXT_<user_id>

### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
Previously, lineage context was being cached with environment-specific prefixes (`public_` in V1 and `public_v2_` in V2), leading to inconsistencies in user experience during login/logout flows across deployments. Switching to a consistent global prefix resolves this by isolating user lineage data under a unified Redis namespace.

## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
Use test cases from this PR: [https://github.com/juspay/hyperswitch/pull/7871](https://github.com/juspay/hyperswitch/pull/7871)

The key should now be in the format of global:LINEAGE_CONTEXT_<user_id>
<img width="1202" alt="image" src="https://github.com/user-attachments/assets/830883c3-5e08-4e00-b101-c2af6a251564" />

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible


Testing:

Use test cases from this PR: [https://github.com/juspay/hyperswitch/pull/7871](https://github.com/juspay/hyperswitch/pull/7871)

The key should now be in the format of global:LINEAGE_CONTEXT_<user_id>
<img width="1202" alt="image" src="https://github.com/user-attachments/assets/830883c3-5e08-4e00-b101-c2af6a251564" />

Patch:
diff --git a/crates/router/src/utils/user.rs b/crates/router/src/utils/user.rs
index 3e339a2a570..13190125d7d 100644
--- a/crates/router/src/utils/user.rs
+++ b/crates/router/src/utils/user.rs
@@ -143,6 +143,27 @@ pub fn get_redis_connection(state: &SessionState) -> UserResult<Arc<RedisConnect
         .attach_printable("Failed to get redis connection")
 }
 
+pub fn get_redis_connection_for_global_tenant(
+    state: &SessionState,
+) -> UserResult<Arc<RedisConnectionPool>> {
+    let redis_connection_pool = state
+        .store
+        .get_redis_conn()
+        .change_context(UserErrors::InternalServerError)
+        .attach_printable("Failed to get redis connection")?;
+
+    let global_tenant_prefix = &state.conf.multitenancy.global_tenant.redis_key_prefix;
+
+    Ok(Arc::new(RedisConnectionPool {
+        pool: Arc::clone(&redis_connection_pool.pool),
+        key_prefix: global_tenant_prefix.to_string(),
+        config: Arc::clone(&redis_connection_pool.config),
+        subscriber: Arc::clone(&redis_connection_pool.subscriber),
+        publisher: Arc::clone(&redis_connection_pool.publisher),
+        is_redis_available: Arc::clone(&redis_connection_pool.is_redis_available),
+    }))
+}
+
 impl ForeignFrom<&user_api::AuthConfig> for UserAuthType {
     fn foreign_from(from: &user_api::AuthConfig) -> Self {
         match *from {
@@ -347,7 +368,7 @@ pub async fn get_lineage_context_from_cache(
     state: &SessionState,
     user_id: &str,
 ) -> UserResult<Option<LineageContext>> {
-    let connection = get_redis_connection(state)?;
+    let connection = get_redis_connection_for_global_tenant(state)?;
     let key = format!("{}{}", LINEAGE_CONTEXT_PREFIX, user_id);
     let lineage_context = connection
         .get_key::<Option<String>>(&key.into())
@@ -371,7 +392,7 @@ pub async fn set_lineage_context_in_cache(
     user_id: &str,
     lineage_context: LineageContext,
 ) -> UserResult<()> {
-    let connection = get_redis_connection(state)?;
+    let connection = get_redis_connection_for_global_tenant(state)?;
     let key = format!("{}{}", LINEAGE_CONTEXT_PREFIX, user_id);
     let serialized_lineage_context: String = serde_json::to_string(&lineage_context)
         .change_context(UserErrors::InternalServerError)