Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ObjectStore to implement a distributed cache in CloudHub

License

NotificationsYou must be signed in to change notification settings

mariocairone/cloudhub-partitionable-objectstore

Repository files navigation

Maven CentralGitHubGitHub issuesGitHub release (latest by date)

The recommended approach to implement a distributed cache in CloudHub, synchronized for all the workers, is to use the default CloudHub persistent Object Store (Using Object Store V2).TheMulesoft Knowledge Base article describes such solution and provide a sample implementation.

The implementation provided in the article, however, do not support partitions, so if we define multiple caches for different purposes all the entries will be stored in the same default partition.

The PartitionableMonitorObjectStore allows to use a different partition for each cache. This will offer a better experience when you need to search or manually expire a particular key.The image below shows an example of how it will look like in the Runtime Manager console:

Object Store

Supported Mule Versions

  • Mule 3.x

Setup

As a dependency of your Maven project:

<dependency>   <groupId>com.mariocairone.mule</groupId>   <artifactId>cloudhub-partitionable-objectstore</artifactId>   <version>1.0.0</version></dependency>

You can also build the.jar file yourself, assuming you have Maven and JDK 1.8+ installed:

mvn clean install

The resulting.jar file will be located in thetarget/ folder.

You can also findSNAPSHOT builds of the latest and greatest changes to the master branch in the SonaType snapshots repository.

To add that snapshot repository to your Maven pom.xml use the following snippet:

<repositories>    <repository>        <id>oss-sonatype</id>        <name>oss-sonatype</name>        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>        <snapshots>            <enabled>true</enabled>        </snapshots>    </repository></repositories>

Configuration

Parameters

NameRequiredTypeDefaultDescription
partitiontrueStringThe partition name
localObjectStoretruePartitionableExpirableObjectStoreThe object store instance
entryTTLfalseInteger-1The time-to-live for each entry, specified in milliseconds.If-1 entries will never expire.Do not combine this with an unbounded store!
maxEntriesfalseInteger4000The maximum number of entries that this store keeps around. Specify-1 if the store is supposed to be "unbounded".
expirationIntervalfalseInteger1000The interval for periodic bounded size enforcement and entry expiration, specified in milliseconds.Arbitrary positive values between 1 millisecond and several hours or days are possible, but should be chosen carefully according to the expected message rate to prevent out of memory conditions.

Example

<ee:object-store-caching-strategyname="MyCacheStrategy"doc:name="Caching Strategy"keyGenerationExpression="#[flowVars.cacheKey]"><custom-object-storeclass="com.mariocairone.mule.objectstore.PartitionableMonitorObjectStore"><spring:propertyname="partition"value="MY_PARTITION"/><spring:propertyname="localObjectStore"ref="_defaultUserObjectStore"/><spring:propertyname="entryTTL"value="${cache.entry.ttl}"/><spring:propertyname="maxEntries"value="${cache.max.entries}"/><spring:propertyname="expirationInterval"value="${cache.expiration.interval}"/></custom-object-store></ee:object-store-caching-strategy>

About

ObjectStore to implement a distributed cache in CloudHub

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp