Bug: refactor(redis_interface): make the redis command for using scripts to write into redis Generic



 make the redis command for using scripts to write into redis as Generic
diff --git a/crates/redis_interface/src/commands.rs b/crates/redis_interface/src/commands.rs
index 3c7ffa16ada..56e9ab98104 100644
--- a/crates/redis_interface/src/commands.rs
+++ b/crates/redis_interface/src/commands.rs
@@ -849,20 +849,23 @@ impl super::RedisConnectionPool {
     }
 
     #[instrument(level = "DEBUG", skip(self))]
-    pub async fn incr_keys_using_script<V>(
+    pub async fn evaluate_redis_script<V, T>(
         &self,
         lua_script: &'static str,
         key: Vec<String>,
         values: V,
-    ) -> CustomResult<(), errors::RedisError>
+    ) -> CustomResult<T, errors::RedisError>
     where
         V: TryInto<MultipleValues> + Debug + Send + Sync,
         V::Error: Into<fred::error::RedisError> + Send + Sync,
+        T: serde::de::DeserializeOwned + FromRedis,
     {
-        self.pool
+        let val: T = self
+            .pool
             .eval(lua_script, key, values)
             .await
-            .change_context(errors::RedisError::IncrementHashFieldFailed)
+            .change_context(errors::RedisError::IncrementHashFieldFailed)?;
+        Ok(val)
     }
 }
 
@@ -955,11 +958,10 @@ mod tests {
                     .await
                     .expect("failed to create redis connection pool");
                 let lua_script = r#"
-                local results = {}
                 for i = 1, #KEYS do
-                    results[i] = redis.call("INCRBY", KEYS[i], ARGV[i])
+                    redis.call("INCRBY", KEYS[i], ARGV[i])
                 end
-                return results
+                return
                 "#;
                 let mut keys_and_values = HashMap::new();
                 for i in 0..10 {
@@ -973,7 +975,45 @@ mod tests {
                     .collect::<Vec<String>>();
 
                 // Act
-                let result = pool.incr_keys_using_script(lua_script, key, values).await;
+                let result = pool
+                    .evaluate_redis_script::<_, ()>(lua_script, key, values)
+                    .await;
+
+                // Assert Setup
+                result.is_ok()
+            })
+        })
+        .await
+        .expect("Spawn block failure");
+
+        assert!(is_success);
+    }
+    #[tokio::test]
+    async fn test_getting_keys_using_scripts() {
+        let is_success = tokio::task::spawn_blocking(move || {
+            futures::executor::block_on(async {
+                // Arrange
+                let pool = RedisConnectionPool::new(&RedisSettings::default())
+                    .await
+                    .expect("failed to create redis connection pool");
+                let lua_script = r#"
+                local results = {}
+                for i = 1, #KEYS do
+                    results[i] = redis.call("GET", KEYS[i])
+                end
+                return results
+                "#;
+                let mut keys_and_values = HashMap::new();
+                for i in 0..10 {
+                    keys_and_values.insert(format!("key{}", i), i);
+                }
+
+                let key = keys_and_values.keys().cloned().collect::<Vec<_>>();
+
+                // Act
+                let result = pool
+                    .evaluate_redis_script::<_, String>(lua_script, key, 0)
+                    .await;
 
                 // Assert Setup
                 result.is_ok()

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
 make the redis command for using scripts to write into redis Generic, for allowing the flexibility to update the redis


### 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).
-->


## How did you test it?

wrote a unit test for it

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [ ] I formatted the code `cargo +nightly fmt --all`
- [ ] I addressed lints thrown by `cargo clippy`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
