Is there a way to use collocation (affinity key) and keep using key\value API without affinity key (just the id itself)?
I'd like to take advantage of collocation using SQL queries but in the same time keep using the key/value API. I mostly use it to specifically sync cache entities (using readthrough), which I cannot do with SQL.
I tried use AffinityKey but I noticed that key/value API search for a complete match of both key and affinity key. For example, I need the key/value API to take advantage of the readthrough capability when I want to load new entity in the DB to the cache. I use get(id)
and because its not in the cache its been loaded from DB - the problem is that using AffinityKey I must also provide the initial affinity key value (in addition to the id) to have a match...
Is there a way to map object by affinity but still working with original integer key? Or maybe use AffinityKey but somehow ignore the affinity key value and use the id only. BTW I've noticed that (unfortunately) key/value API doesn't use AffinityKey.equals, seems like there is some wrapper KeyCacheObject, otherwise the AffinityKey.equals would have found a match.