#1215 - ENH: Add Query setBeanCacheMode(CacheMode) ... with a view to it replacing the existing setUseCache(boolean) and setLoadBeanCache(boolean)

This commit is contained in:
Rob Bygrave
2017-11-19 20:16:40 +13:00
parent ef91c643ed
commit 7ff3d703f7
15 changed files with 124 additions and 43 deletions
+6 -3
View File
@@ -1,16 +1,19 @@
package org.tests.cache;
import io.ebean.BaseTestCase;
import io.ebean.CacheMode;
import io.ebean.Ebean;
import io.ebean.cache.ServerCache;
import io.ebean.cache.ServerCacheStatistics;
import org.junit.Test;
import org.tests.model.basic.Contact;
import org.tests.model.basic.ResetBasicData;
import org.junit.Test;
import java.util.List;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class TestCacheNaturalId extends BaseTestCase {
@@ -21,7 +24,7 @@ public class TestCacheNaturalId extends BaseTestCase {
ServerCache contactCache = Ebean.getServerCacheManager().getBeanCache(Contact.class);
List<Contact> list = Ebean.find(Contact.class).setLoadBeanCache(true).findList();
List<Contact> list = Ebean.find(Contact.class).setBeanCacheMode(CacheMode.RECACHE).findList();
assertTrue(contactCache.size() > 0);