Search code examples
javacachingignitedistributed-caching

Query Apache Ignite's cache for a local backup entries only


We can use Ignite's ScanQuery object for example to query only a local cache for entries. Like this:

    ScanQuery<Object, Object> qry = new ScanQuery<>()
                    .setLocal(true);

Now, if we have a cache with cacheConfiguration.setBackups(1), is there any way to query only backup entries, locally stored on a node?

It is possible if we use

igniteCache.localEntries(CachePeekMode.BACKUP);

But, I would really need a ScanQuery here, for its setPageSize method.


Solution

  • It's not possible to use ScanQuery on local node only from backups, so, I think you should use

    igniteCache.localEntries(CachePeekMode.BACKUP)
    

    for this case.

    By the way, what is your use case? Maybe I can recommend something better for you.