flowable关闭自带缓存
时间: 2023-07-09 19:15:01 浏览: 129
Flowable默认开启了缓存,用于提高流程实例的执行效率。如果需要关闭自带缓存,可以通过以下两种方式实现:
1. 在Flowable配置文件中配置缓存属性
在 Flowable 的配置文件(如 flowable.cfg.xml 或 application.properties)中,可以配置流程实例缓存的属性,将缓存策略设置为 none 来关闭自带缓存。示例如下:
```
<property name="process.cache.enabled" value="false" />
```
或者
```
flowable.process.cache.enabled=false
```
2. 通过ProcessEngineConfiguration对象配置缓存属性
可以通过ProcessEngineConfiguration对象来设置缓存属性,示例代码如下:
```
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
processEngineConfiguration.setProcessInstanceCacheEnabled(false);
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
```
以上两种方式均可用于关闭自带缓存,具体选择哪种方式取决于具体的场景和需求。需要注意的是,关闭自带缓存可能会对流程实例的执行效率产生一定的影响,需要根据实际情况进行评估和测试。