Java Code Examples for org.apache.ibatis.cache.decorators.FifoCache#putObject()
The following examples show how to use
org.apache.ibatis.cache.decorators.FifoCache#putObject() .
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: FifoCacheTest.java From mybaties with Apache License 2.0 | 5 votes |
@Test public void shouldRemoveFirstItemInBeyondFiveEntries() { FifoCache cache = new FifoCache(new PerpetualCache("default")); cache.setSize(5); for (int i = 0; i < 5; i++) { cache.putObject(i, i); } assertEquals(0, cache.getObject(0)); cache.putObject(5, 5); assertNull(cache.getObject(0)); assertEquals(5, cache.getSize()); }
Example 2
Source File: FifoCacheTest.java From mybaties with Apache License 2.0 | 5 votes |
@Test public void shouldRemoveItemOnDemand() { FifoCache cache = new FifoCache(new PerpetualCache("default")); cache.putObject(0, 0); assertNotNull(cache.getObject(0)); cache.removeObject(0); assertNull(cache.getObject(0)); }
Example 3
Source File: FifoCacheTest.java From mybaties with Apache License 2.0 | 5 votes |
@Test public void shouldFlushAllItemsOnDemand() { FifoCache cache = new FifoCache(new PerpetualCache("default")); for (int i = 0; i < 5; i++) { cache.putObject(i, i); } assertNotNull(cache.getObject(0)); assertNotNull(cache.getObject(4)); cache.clear(); assertNull(cache.getObject(0)); assertNull(cache.getObject(4)); }
Example 4
Source File: FifoCacheTest.java From mybatis with Apache License 2.0 | 5 votes |
@Test public void shouldRemoveFirstItemInBeyondFiveEntries() { FifoCache cache = new FifoCache(new PerpetualCache("default")); cache.setSize(5); for (int i = 0; i < 5; i++) { cache.putObject(i, i); } assertEquals(0, cache.getObject(0)); cache.putObject(5, 5); assertNull(cache.getObject(0)); assertEquals(5, cache.getSize()); }
Example 5
Source File: FifoCacheTest.java From mybatis with Apache License 2.0 | 5 votes |
@Test public void shouldRemoveItemOnDemand() { FifoCache cache = new FifoCache(new PerpetualCache("default")); cache.putObject(0, 0); assertNotNull(cache.getObject(0)); cache.removeObject(0); assertNull(cache.getObject(0)); }
Example 6
Source File: FifoCacheTest.java From mybatis with Apache License 2.0 | 5 votes |
@Test public void shouldFlushAllItemsOnDemand() { FifoCache cache = new FifoCache(new PerpetualCache("default")); for (int i = 0; i < 5; i++) { cache.putObject(i, i); } assertNotNull(cache.getObject(0)); assertNotNull(cache.getObject(4)); cache.clear(); assertNull(cache.getObject(0)); assertNull(cache.getObject(4)); }