shikeyin
2024-01-11 65da8373531677b1c37a98f53eaa30c892f35e5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.iplatform.chat.config;
 
import com.iplatform.chat.ChatSessionCache;
import com.iplatform.chat.cache.LocalChatSessionCache;
import com.iplatform.chat.service.ChatDialogServiceImpl;
import com.iplatform.core.PlatformConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
@Configuration
@ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "false", matchIfMissing = true)
public class LocalChatCacheConfig extends PlatformConfiguration {
 
    @Bean
    public ChatSessionCache chatSessionCache(ChatDialogServiceImpl chatDialogService){
        LocalChatSessionCache cache = new LocalChatSessionCache();
        cache.setChatDialogService(chatDialogService);
        return cache;
    }
}