I am looking for this feature to be able to write to Cassandra through Ignite layer on top similar to how Cassandra supports "with" timestamp feature, so that stale updates can be eliminated. The reason we want to write through Ignite is because we may get a read call immediately after writing and the API needs to serve the latest and not wait for TTL or LRU on Ignite Cache. On the other hand, we could write to Cassandra directly and then invalidate/remove the entry to ensure latest data is served. But there could be a better way?
Asked
Active
Viewed 59 times
2
-
Define `better'? I'm not sure there is a specific answer here. – alamar Apr 01 '20 at 09:40
1 Answers
2
It seems that what you need is a cache with read-through and write-through enabled. Create a cache with a configuration similar to the following:
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="cache1"/>
<property name="readThrough" value="true"/>
<property name="writeThrough" value="true"/>
<property name="cacheStoreFactory">
<bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
<!-- ... -->
</bean>
</property>
</bean>
When you write to this cache, the write will be syncrhonously propagated to Cassandra, and when you read it, Ignite will fetch the value from Cassandra if it doesn't have it already.
NOTE: If you write to Cassandra directly, Ignite won't know about that and will continue serving stale values. When using read-through and write-though it's best to route all your writes through Ignite.

Stanislav Lukyanov
- 2,147
- 10
- 20