我正在寻找一种方法来在两台服务器之间共享缓存,我正在研究使用Redis作为对象存储缓存策略,但是在读取存储值时遇到问题。使用Redis的骡子缓存策略
当缓存命中是未命中值时,它会成功存储值,但在检索该值时会引发错误。
所需的对象/属性“muleContext”为空
在猜测它看起来像对象店缓存策略可能需要一个实现MuleContextAware接口的对象存储。
有谁知道这是否正确或如何解决此问题?
这里是例如流
<mule xmlns:redis="http://www.mulesoft.org/schema/mule/redis" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/redis http://www.mulesoft.org/schema/mule/redis/3.4/mule-redis.xsd">
<redis:config name="Redis" doc:name="Redis" defaultPartitionName="test" />
<ee:object-store-caching-strategy name="Redis_Caching_Strategy" doc:name="Caching Strategy">
<spring-object-store ref="Redis" />
</ee:object-store-caching-strategy>
<flow name="htmlCacheRedisFlow" doc:name="htmlCacheRedisFlow">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8084" path="cacheRedis" doc:name="HTTP"/>
<expression-transformer expression="#[payload.substring(payload.lastIndexOf('/') + 1)]" doc:name="Expression"/>
<ee:cache doc:name="Cache" cachingStrategy-ref="Redis_Caching_Strategy" >
<logger message="getting item from db for key #[payload]" level="INFO" doc:name="Logger"/>
<expression-transformer expression="#[payload + 'asd']" doc:name="Expression"/>
</ee:cache>
</flow>
</mule>
请记住,由于您使用的企业版,您可以联系以寻求帮助MuleSoft的专业支持。此功能不是社区版的一部分,所以这里的社区在StackOverflow可能无法帮助你...但这是一个很好的问题:) –
好的,谢谢我没有意识到我仍然有运行时在工作室设置为EE。现在我改变了这一点,我看到缓存不再可用,所以这个问题不再适用于我。 – Stuart