0
votes

I have a spring boot service that writes to an apache ignite cache. The cache is writethrough,writebehind and readthrough. I have mysql as a persistence store that the cache writesbehind to. I would like to clear all cache entries that have been written to the mysql database from the cache.

I am using the cache as a staging area so that i do not make a db call every second instead i set the cache to writebehind every 30 seconds.

I would like to know how to clear to cache once writebehind is complete.

2

2 Answers

0
votes

You may call cache.clear() - it will not remove entries from underlying 3rd party persistence if that's what you ask.

0
votes

I think the only way is to extend CacheStore that you use, after writes to DB just create a task to remove persisted records, but make sure that you execute it in async way and with withSkipStore, otherwise you can easily get deadlock or/and thread starvation.