hunk.code_window: @Configuration
   @Slf4j
   public class RedisConfig {
       @Bean
       public ReactiveRedisTemplate<String, String> reactiveRedisTemplate(ReactiveRedisConnectionFactory factory) {
           return new ReactiveRedisTemplate<>(factory, RedisSerializationContext.string());
  
hunk.labels: keep keep add keep keep keep keep keep
hunk.after_edit: @EnableRedisWebSession
  
hunk.file_path: app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/RedisConfig.java
hunk.type: add
file: package com.appsmith.server.services;
  
  import com.appsmith.server.domains.Query;
  import com.appsmith.server.dtos.CommandQueryParams;
  import com.appsmith.server.dtos.OldParam;
  import com.github.mustachejava.DefaultMustacheFactory;
  import com.github.mustachejava.Mustache;
  import com.github.mustachejava.MustacheFactory;
  import reactor.core.publisher.Flux;
  
  import java.io.StringReader;
  import java.io.StringWriter;
  import java.io.Writer;
  import java.util.HashMap;
  import java.util.Map;
  import java.util.stream.Collectors;
  
  public abstract class OldPluginExecutor {
  
      /**
       * This function executes the command against a backend datasource.
       * All the variables in commandTemplate of the Query object has already been replaced with actual values
       * by the #replaceTemplate() function
       *
       * @param query
       * @param params
       * @return Flux<Object>
       */
      protected abstract Flux<Object> execute(Query query, CommandQueryParams params);
  
      /**
       * This function should be run when the plugin is initialized
       */
      protected abstract void init();
  
      /**
       * This function should be run when the plugin is destroyed
       */
      protected abstract void destroy();
  
      /**
       * This function replaces the variables in the query commandTemplate with the actual params
       * Executors can override this function to provide their own implementation if they wish to do something custom
       *
       * @param query  Query
       * @param params CommandQueryParams
       */
      protected Query replaceTemplate(Query query, CommandQueryParams params) {
          MustacheFactory mf = new DefaultMustacheFactory();
          Mustache mustache = mf.compile(new StringReader(query.getCommandTemplate()), "commandTemplate");
          Writer writer = new StringWriter();
  
          Map<String, String> queryMap = new HashMap<>();
          Map<String, String> headerMap = new HashMap<>();
          if (params.getQueryOldParams() != null) {
              queryMap = params
                      .getQueryOldParams()
                      .stream()
                      .collect(
                              Collectors.toMap(OldParam::getKey, OldParam::getValue,
                                      // Incase there's a conflict, we pick the older value
                                      (oldValue, newValue) -> oldValue));
          }
          if (params.getHeaderOldParams() != null) {
              headerMap = params
                      .getHeaderOldParams()
                      .stream()
                      .collect(
                              Collectors.toMap(OldParam::getKey, OldParam::getValue,
                                      // Incase there's a conflict, we pick the older value
                                      (oldValue, newValue) -> oldValue));
          }
          mustache.execute(writer, queryMap);
  
          query.setCommandTemplate(writer.toString());
          return query;
      }
  }
  