package com.dayou.workflow.config;

import com.dayou.dto.WorkNodeDTO;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * 类说明：
 *
 * @author: wucl
 * @since: 2023/10/27
 * created with IntelliJ IDEA.
 */
@Configuration
public class WorkflowConfig {


    @Bean
    @Qualifier("workflowCache")
    public Cache<Long, List<WorkNodeDTO>> workflowCache() {
        Cache<Long, List<WorkNodeDTO>> cache = CacheBuilder.newBuilder()
                .expireAfterAccess(24, TimeUnit.HOURS).build();
        return cache;
    }
}
