@EnableSpringHttpSession with apache ignite - PullRequest
       73

@EnableSpringHttpSession with apache ignite

0 голосов
/ 06 апреля 2020

Я использую apache ignite для сохранения сеанса.

@Configuration
@EnableSpringHttpSession
public class IgniteSessionConfiguration {

    /**
     * Max inactive interval in seconds
     */
    @Value("${spring.session.ignite.defaultMaxInactiveInterval:#{null}}")
    private Integer maxInactiveInterval;

    @Bean
    public SessionRepository<ExpiringSession> sessionRepository(@NonNull Ignite ignite,
                                                                @NonNull CacheConfiguration<String, ExpiringSession> sessionCacheConfiguration) {
        val sessionCache = ignite.getOrCreateCache(sessionCacheConfiguration);
        val mappedSessionCache = new CacheMapAdapter<String, ExpiringSession>(sessionCache);
        val sessionRepository = new MapSessionRepository(mappedSessionCache);
        Optional.ofNullable(maxInactiveInterval)
                .ifPresent(sessionRepository::setDefaultMaxInactiveInterval);
        return sessionRepository;
    }
}

работает нормально, но сервер зажигания работает, но не просрочен. Поэтому я нашел этот комментарий в 'org.springframework.session.config.annotation.web.http.SpringHttpSessionConfiguration'

SessionEventHttpSessionListenerAdapter - is responsible for translating Spring
 * Session events into HttpSessionEvent. In order for it to work, the implementation of
 * SessionRepository you provide must support {@link SessionCreatedEvent} and
 * {@link SessionDestroyedEvent}.

Я не знаю, как SessionRepository поддерживает эти SessionDestroyedEvent Пожалуйста, помогите мне ..

Спасибо

...