19 Eylül 2021 Pazar

Oracle Coherence

Giriş
Benim gözümde Memcached muadili idi ancak aslında çok daha fazla şey yapabiliyor.

1. SpringBoot İle Kullanma
Maven ile şu satırı dahil ederiz
<dependencies>
  <dependency>
    <groupId>com.oracle.coherence.spring</groupId>
    <artifactId>coherence-spring-boot-starter</artifactId>
    <version>3.0.0-M1</version>
  </dependency>
  <dependency>
    <groupId>com.oracle.coherence.ce</groupId>
    <artifactId>coherence</artifactId>
    <version>21.06-M2</version>
  </dependency>
</dependencies>
Açıklaması şöyle
CoherenceAutoConfiguration will kick in, bootstrap Coherence, and you can immediately start injecting Coherence dependencies into your Spring-managed classes using a rich set of available annotations including:

- @CoherenceCache
- @CoherenceMap
- Filter Binding Annotations
- Extractor Binding Annotations
- and many more
2. Cache Olarak Kullanma
Açıklaması şöyle. Burada özel bir şey yapmaya gerek yok. Spring'e ait anotasyonları kullanmak yeterli.
If you need to use Coherence for caching using Spring’s Cache abstraction, just add the @EnableCaching annotation and CoherenceAutoConfiguration will add a CoherenceCacheManager to the Spring ApplicationContext.

Now you can take advantage of Spring’s Cache abstraction that is backed by Coherence and use the relevant Spring annotations such as @Cacheable, @CacheEvict, @CachePut.
3. Oracle Coherence'a Mahsus Anotasyonlar

@CoherenceEventListener Anotasyonu
Örnek
Şöyle yaparız. Burada   @Where ile CohQL expression kullanılıyor
@CoherenceEventListener
@MapName("people") @WhereFilter("age >= 18") public void onAdult(MapEvent<String, Person> people) { // TODO: process the event... }

@CoherenceMap Anotasyonu
Örnek
Şöyle yaparız
@CoherenceMap
private NamedMap<String, Person> people;


Hiç yorum yok:

Yorum Gönder