本文整理了Java中com.j256.ormlite.dao.Dao.clearObjectCache()
方法的一些代码示例,展示了Dao.clearObjectCache()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dao.clearObjectCache()
方法的具体详情如下:
包路径:com.j256.ormlite.dao.Dao
类名称:Dao
方法名:clearObjectCache
[英]Flush the object cache if it has been enabled. This will remove an objects that are in the cache to reclaim memory. Any future queries will re-request them from the database.
[中]如果对象缓存已启用,则刷新它。这将删除缓存中的对象以回收内存。将来的任何查询都将从数据库中重新请求它们。
代码示例来源:origin: j256/ormlite-core
/**
* @see Dao#clearObjectCache()
*/
@Override
public void clearObjectCache() {
dao.clearObjectCache();
}
代码示例来源:origin: com.j256.ormlite/ormlite-core
/**
* @see Dao#clearObjectCache()
*/
@Override
public void clearObjectCache() {
dao.clearObjectCache();
}
代码示例来源:origin: j256/ormlite-core
@Test
public void testQueryAll() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
dao.setObjectCache(true);
Foo foo = new Foo();
int val = 12312321;
foo.val = val;
assertEquals(1, dao.create(foo));
dao.clearObjectCache();
List<Foo> results = dao.queryForAll();
assertEquals(1, results.size());
assertEquals(foo.id, results.get(0).id);
assertNotSame(foo, results.get(0));
Foo foo2 = dao.queryForId(foo.id);
assertNotNull(foo2);
assertEquals(foo.id, results.get(0).id);
assertSame(results.get(0), foo2);
}
代码示例来源:origin: j256/ormlite-core
@Test
public void testClear() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
LruObjectCache cache = new LruObjectCache(2);
dao.setObjectCache(cache);
Foo foo = new Foo();
int val = 12312321;
foo.val = val;
assertEquals(1, dao.create(foo));
assertEquals(1, cache.size(Foo.class));
Foo result = dao.queryForId(foo.id);
assertSame(foo, result);
dao.clearObjectCache();
result = dao.queryForId(foo.id);
assertNotSame(foo, result);
}
代码示例来源:origin: j256/ormlite-core
assertSame(order1, order2);
accountDao.clearObjectCache();
orderDao.clearObjectCache();
BaseDaoImpl.clearAllInternalObjectCaches();
内容来源于网络,如有侵权,请联系作者删除!