Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Jcache - cacheManager.getCache("myCache") always null

Helder KlempMar 17 2015 — edited Mar 17 2015

Hello guys,

I'm trying to implement Oracle Cohere into a pre-defined application, this application uses Spring Cache ( Jcache ) with HazelCast.

Following the simple tutorial on Coherence documentation I could create a local cache and put some objects without problems, using the above code:

         // get cache manager

        CachingProvider cachingProvider = Caching.getCachingProvider();

        CacheManager cacheManager = cachingProvider.getCacheManager();

        //create and use the cache

        cacheManager.createCache("myCache", config);

        Cache<String, String> cache = cacheManager.getCache("myCache",

             String.class, String.class);

However, this code always create a cache ( cacheManager.createCache("myCache", config); ) I was wondering how to configure a client app that connect to a existent cache using Jcache API.

Following you can find my coherence-jcache-cache-config.xml

<caching-scheme-mapping>

          <cache-mapping>

             <cache-name>myCache</cache-name>

             <scheme-name>distributed</scheme-name>

          </cache-mapping>

       </caching-scheme-mapping>

      

       <caching-schemes>

          <distributed-scheme>

             <scheme-name>distributed</scheme-name>

             <service-name>DistributedCache</service-name>

             <backing-map-scheme>

                <local-scheme/>

             </backing-map-scheme>

             <autostart>true</autostart>

          </distributed-scheme>

       </caching-schemes>

    </cache-config>

Is there any complete example using Jcache Coherence with external cluster ? or using Jcache with Spring and @CacheResult (javax.cache: The new Java Caching Standard | Greg Luck's Blog) ?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 14 2015
Added on Mar 17 2015
0 comments
1,022 views