خرید بک لینک

Vote count: 0

I need to pull data from Apache Ignite Cache and show it on JSP. data size is in million so I need to setup Server side pagination. Apache Ignite docs does not say much about pagination except setting pageSize to query which by default is 1024. How do I pass startIndex and endIndex, basically the parameters which we passed when implementing pagination with database. For example, I have below sample code to query cache, can we apply pagination to it by passing certain parameters.

public Set<String> getData(int pageSize){
        Ignite ignite = Ignition.start("examples/config/example-ignite.xml");
        CacheConfiguration<Integer, String> config = new CacheConfiguration<>("mycache");
        config.setBackups(1);
        IgniteCache<Integer, String> cache = ignite.getOrCreateCache(config);
        long dataSize = 30;
        for (int i = 1; i < dataSize; i++) {
            cache.put(i, String.valueOf(i));
        }

        ScanQuery<Integer, String> query = new ScanQuery<>((Integer e1, String e2) ->e1>10);
        Set<String> res = cache.query(query.setPageSize(pageSize)).getAll().stream().map(Cache.Entry::getValue).collect(toSet()); 
        System.out.println(res);
        retu res;
    }

Thanks

asked 29 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 28 تير 1395 ساعت: 13:42

صفحه بندی