use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy in project ignite by apache.
the class EvictionPolicies method FIFO.
public static void FIFO() {
// tag::FIFO[]
CacheConfiguration cacheCfg = new CacheConfiguration();
cacheCfg.setName("cacheName");
// Enabling on-heap caching for this distributed cache.
cacheCfg.setOnheapCacheEnabled(true);
// Set the maximum cache size to 1 million (default is 100,000).
cacheCfg.setEvictionPolicyFactory(() -> new FifoEvictionPolicy(1000000));
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setCacheConfiguration(cacheCfg);
// end::FIFO[]
}
use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy in project ignite by apache.
the class GridCacheObjectToStringSelfTest method testLocalCacheFifoEvictionPolicy.
/**
* @throws Exception If failed.
*/
@Test
public void testLocalCacheFifoEvictionPolicy() throws Exception {
cacheMode = LOCAL;
evictionPlc = new FifoEvictionPolicy();
checkToString();
}
use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy in project ignite by apache.
the class GridCacheObjectToStringSelfTest method testPartitionedCacheFifoEvictionPolicy.
/**
* @throws Exception If failed.
*/
@Test
public void testPartitionedCacheFifoEvictionPolicy() throws Exception {
cacheMode = PARTITIONED;
nearEnabled = true;
evictionPlc = new FifoEvictionPolicy();
checkToString();
}
use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy in project ignite by apache.
the class GridCacheObjectToStringSelfTest method testColocatedCacheFifoEvictionPolicy.
/**
* @throws Exception If failed.
*/
@Test
public void testColocatedCacheFifoEvictionPolicy() throws Exception {
cacheMode = PARTITIONED;
nearEnabled = false;
evictionPlc = new FifoEvictionPolicy();
checkToString();
}
use of org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy in project ignite by apache.
the class PlatformConfigurationUtils method writeEvictionPolicy.
/**
* Writes the eviction policy.
* @param out Stream.
* @param p Policy.
*/
private static void writeEvictionPolicy(BinaryRawWriter out, EvictionPolicy p) {
if (p instanceof FifoEvictionPolicy) {
out.writeByte((byte) 1);
FifoEvictionPolicy p0 = (FifoEvictionPolicy) p;
out.writeInt(p0.getBatchSize());
out.writeInt(p0.getMaxSize());
out.writeLong(p0.getMaxMemorySize());
} else if (p instanceof LruEvictionPolicy) {
out.writeByte((byte) 2);
LruEvictionPolicy p0 = (LruEvictionPolicy) p;
out.writeInt(p0.getBatchSize());
out.writeInt(p0.getMaxSize());
out.writeLong(p0.getMaxMemorySize());
} else
out.writeByte((byte) 0);
}
Aggregations