Search in sources :

Example 26 with FifoEvictionPolicy

use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy in project ignite by apache.

the class IgniteSqlSegmentedIndexSelfTest method testSizeOnSegmentedIndexWithEvictionPolicy.

/**
 * Verifies that <code>select count(*)</code> return valid result on a single-node grid.
 *
 * @throws Exception If failed.
 */
public void testSizeOnSegmentedIndexWithEvictionPolicy() throws Exception {
    final IgniteCache<Object, Object> cache = ignite(0).createCache(cacheConfig(ORG_CACHE_NAME, true, Integer.class, Organization.class).setEvictionPolicy(new FifoEvictionPolicy(10)).setOnheapCacheEnabled(true));
    final long SIZE = 20;
    for (int i = 0; i < SIZE; i++) cache.put(i, new Organization("org-" + i));
    String select0 = "select count(*) from \"org\".Organization";
    List<List<?>> res = cache.query(new SqlFieldsQuery(select0)).getAll();
    assertEquals(SIZE, res.get(0).get(0));
}
Also used : List(java.util.List) FifoEvictionPolicy(org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy) SqlFieldsQuery(org.apache.ignite.cache.query.SqlFieldsQuery)

Aggregations

FifoEvictionPolicy (org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy)26 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)8 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)8 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)7 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)7 Ignite (org.apache.ignite.Ignite)5 List (java.util.List)2 LruEvictionPolicy (org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)2 SqlFieldsQuery (org.apache.ignite.cache.query.SqlFieldsQuery)2 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1 TreeSet (java.util.TreeSet)1 Cache (javax.cache.Cache)1 Factory (javax.cache.configuration.Factory)1 Duration (javax.cache.expiry.Duration)1 IgniteCache (org.apache.ignite.IgniteCache)1 FifoEvictionPolicyFactory (org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicyFactory)1 GridCacheAlwaysEvictionPolicy (org.apache.ignite.internal.processors.cache.GridCacheAlwaysEvictionPolicy)1 PA (org.apache.ignite.internal.util.typedef.PA)1 Transaction (org.apache.ignite.transactions.Transaction)1