flowable 图片缓存
生活随笔
收集整理的這篇文章主要介紹了
flowable 图片缓存
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
背景
由于我們的每次顯示圖片的話,都將需要大量的查詢和相關的流。這樣對我們的系統壓力極大,用戶體驗極差。
所以使用了緩存把圖片流緩存起來,這樣就可以解決問題了。
實現
這里我用的是ehcache,由于他小巧依賴少。
1.把我們的包導入進來
<!--開啟 cache 緩存--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-cache</artifactId></dependency><!-- ehcache 緩存 --><dependency><groupId>net.sf.ehcache</groupId><artifactId>ehcache</artifactId></dependency>2.配置xml文件
<?xml version="1.0" encoding="UTF-8"?> <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"updateCheck="false"><diskStore path="/data/flow/ehcache"/><defaultCacheeternal="false"maxElementsInMemory="900"overflowToDisk="false"diskPersistent="false"timeToIdleSeconds="0"timeToLiveSeconds="30"memoryStoreEvictionPolicy="LRU"/><!-- 這里的 cache-process-image 緩存流程的圖片信息 --><cachename="cache-process-image"eternal="false"maxElementsInMemory="2000"maxElementsOnDisk="3000"overflowToDisk="true"diskPersistent="true"timeToIdleSeconds="0"timeToLiveSeconds="1296000"memoryStoreEvictionPolicy="LRU"/> </ehcache>3.配置application.properties文件
spring.cache.ehcache.config=classpath:/ehcache/flow-ehcache.xml4.配置緩存注解
@Cacheable(value = FlowConstant.CACHE_PROCESS_IMAGE, key = "'" + FlowConstant.PROCESSINSTANCE_PREFIX + "'+ #processDefinitionId")public byte[] createImage(String processDefinitionId) {}總結
以上是生活随笔為你收集整理的flowable 图片缓存的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Element-UI中Cascader
- 下一篇: (Docker实战) 第五篇:建立持续集