Java Code Examples for org.apache.ignite.IgniteCache#localLoadCache()

The following examples show how to use org.apache.ignite.IgniteCache#localLoadCache() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IgniteCacheExpiryStoreLoadSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @param async If {@code true} uses asynchronous method.
 * @throws Exception If failed.
 */
private void checkLocalLoad(boolean async) throws Exception {
    final IgniteCache<String, Integer> cache = jcache(0)
        .withExpiryPolicy(new CreatedExpiryPolicy(new Duration(MILLISECONDS, TIME_TO_LIVE)));

    List<Integer> keys = primaryKeys(cache, 3);

    if (async)
        cache.localLoadCacheAsync(null, keys.toArray(new Integer[3])).get();
    else
        cache.localLoadCache(null, keys.toArray(new Integer[3]));

    assertEquals(3, cache.localSize());

    boolean res = GridTestUtils.waitForCondition(new PA() {
        @Override public boolean apply() {
            return cache.localSize() == 0;
        }
    }, TIME_TO_LIVE + WAIT_TIME);

    assertTrue(res);
}
 
Example 2
Source File: GridCacheLoadOnlyStoreAdapterSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testStoreSmallQueueSize() throws Exception {
    int inputSize = 1500;

    store = new ParallelTestStore(inputSize);

    store.setBatchSize(1);
    store.setBatchQueueSize(1);
    store.setThreadsCount(2);

    IgniteCache<?, ?> cache = grid(0).createCache(cacheConfiguration());

    cache.localLoadCache(null, 1, 2, 3);

    assertEquals(inputSize, cache.localSize());

}
 
Example 3
Source File: GridCacheLoadOnlyStoreAdapterSelfTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testStore() throws Exception {
    int inputSize = 100;

    store = new TestStore(inputSize);

    IgniteCache<?, ?> cache = grid(0).createCache(cacheConfiguration());

    cache.localLoadCache(null, 1, 2, 3);

    assertEquals(inputSize - (inputSize / 10), cache.localSize());
}