Hazelcast缓存时序问题

我面临有关hazelcast缓存的问题。hazelcast缓存大约需要5秒钟。 目前,我正在将hazelcast与springboot应用程序一起使用。我在hazelcast中在服务级别上缓存了一个方法。缓存数据大小以kb为单位。我正在通过控制器调用此服务方法。从缓存中返回数据所花费的时间是5秒,这非常高。我认为应该以毫秒为单位。如果您的数据已被缓存,则应该以毫秒为单位进行处理。

这是我的控制器和服务:

控制器:

@GetMapping(value = "/statusSummaryFilters",produces = MediaTypes.HAL_JSON_VALUE)               
 public ResponseEntity<StatusSummaryDataResource> getStatusSummaryData(@RequestParam Long epochTime)              
 {
return ResponseEntity.ok(statusSummaryService.getcachedStatusSummaryData(epochTime));
   }

**StatusSummaryService:**

// This is the service method from where i returned the cached data.Data is in form of list of objects.Nearly around 36000 objects of StatusSummaryDto.

    @SuppressWarnings("unchecked")
    @Cacheable(value = Constants.CACHE_STATUS_SUMMARY_DATA,sync = true)
    public List<StatusSummaryDto> getcachedStatusSummaryData(Long endDateEpochTime) { 
}

Hazelcast配置:

package com.hns.services.restapi.config;
import com.hazelcast.config.Config;
import com.hazelcast.config.EvictionPolicy;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.MaxSizeConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static com.hns.services.restapi.constants.Constants.*;

@Configuration
public class CacheConfig {
    private static final Integer TTL_SECS = 3600;

    @Bean
    public Config hazelcastConfig() {
        return new Config().setInstanceName("hazelcast-instance-parteek").setProperty("hazelcast.initial.min.cluster.size","1")

                .addMapConfig(new MapConfig().setName(CACHE_STATUS_SUMMARY_DATA)
                        .setMaxSizeConfig(new MaxSizeConfig(100,MaxSizeConfig.MaxSizePolicy.FREE_HEAP_SIZE))
                        .setEvictionPolicy(EvictionPolicy.LRU)
                        .setTimeToLiveSeconds(TTL_SECS));         
    }
}

请告诉我是否做错了什么。如果我在hazelcast配置中缺少某些内容,请告诉我,以便我进行修复。

map712 回答:Hazelcast缓存时序问题

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2995647.html

大家都在问