Search code examples
javamysqlignite

How do I make sure cache key and object id is the same when using Ignite together with mysql as a 3rd party persistent storage


I am using apache ignite with mysql persistent storage. I implemented a store by extending the CacheStoreAdapter. When overriding the loadCache method I use the entry id from the mysql db as a key for the cache.

How can I have the same id in the db and the same key in the cache when creating a new entry, without auto generating something that already exists in the db? I cannot iterate over the existing keys in memory because I don't load all entries for a table from the db.


Solution

  • Can you resort to UUIDs? Otherwise, if you have AUTO INCREMENT in DB you will have to create entries in DB and then load them up in cache.