asp网站怎么打开,网站开发范例文档,做网站需要的大图,太原模板建站背景 由于我们的每次显示图片的话#xff0c;都将需要大量的查询和相关的流。这样对我们的系统压力极大#xff0c;用户体验极差。
所以使用了缓存把图片流缓存起来#xff0c;这样就可以解决问题了。
实现 这里我用的是ehcache#xff0c;由于他小巧依赖少。
1.把我们的…背景 由于我们的每次显示图片的话都将需要大量的查询和相关的流。这样对我们的系统压力极大用户体验极差。
所以使用了缓存把图片流缓存起来这样就可以解决问题了。
实现 这里我用的是ehcache由于他小巧依赖少。
1.把我们的包导入进来
!--开启 cache 缓存--dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-cache/artifactId/dependency!-- ehcache 缓存 --dependencygroupIdnet.sf.ehcache/groupIdartifactIdehcache/artifactId/dependency
2.配置xml文件
?xml version1.0 encodingUTF-8?
ehcache xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:noNamespaceSchemaLocationhttp://ehcache.org/ehcache.xsdupdateCheckfalsediskStore path/data/flow/ehcache/defaultCacheeternalfalsemaxElementsInMemory900overflowToDiskfalsediskPersistentfalsetimeToIdleSeconds0timeToLiveSeconds30memoryStoreEvictionPolicyLRU/!-- 这里的 cache-process-image 缓存流程的图片信息 --cachenamecache-process-imageeternalfalsemaxElementsInMemory2000maxElementsOnDisk3000overflowToDisktruediskPersistenttruetimeToIdleSeconds0timeToLiveSeconds1296000memoryStoreEvictionPolicyLRU/
/ehcache
3.配置application.properties文件
spring.cache.ehcache.configclasspath:/ehcache/flow-ehcache.xml
4.配置缓存注解
Cacheable(value FlowConstant.CACHE_PROCESS_IMAGE, key FlowConstant.PROCESSINSTANCE_PREFIX #processDefinitionId)public byte[] createImage(String processDefinitionId) {}