NutzCN Logo
问答 daocache这个是咋用的呢?
发布于 1748天前 作者 carolwelcome 1462 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

配置:

dao : {
			type : "org.nutz.dao.impl.NutDao",
			args : [{refer:"dataSource"}],
			fields : {
				executor : {refer:"cacheExecutor"}
			}
		},
		cacheExecutor : {
			type : "org.nutz.plugins.cache.dao.CachedNutDaoExecutor",
			fields : {
				cacheProvider : {refer:"cacheProvider"},
				cachedTableNames : ["sys_user", "sys_role", "sys_menu"],
				enableWhenTrans : false, // 事务作用域内不启用缓存,默认也是false
				db : "ORACLE"
			}
		},

日志:

[DEBUG] 2020-03-09 19:24:09,893 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT * FROM sys_role  WHERE code=?) T WHERE ROWNUM <= 1) WHERE RN > 0 
    |        1 |
    |----------|
    | sysadmin |
  For example:> "SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT * FROM sys_role  WHERE code='sysadmin') T WHERE ROWNUM <= 1) WHERE RN > 0 "
[DEBUG] 2020-03-09 19:24:09,897 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT * FROM sys_role  WHERE code=?) T WHERE ROWNUM <= 1) WHERE RN > 0 , tables = []
[DEBUG] 2020-03-09 19:24:09,897 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:178) - not good for cache >> SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT * FROM sys_role  WHERE code=?) T WHERE ROWNUM <= 1) WHERE RN > 0 
[DEBUG] 2020-03-09 19:24:09,936 com.js.collection.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) - [GET ]URI=/tenant/test/get 74ms
[DEBUG] 2020-03-09 19:24:48,002 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/tenant/test/get : TenantTestController.get(TenantTestController.java:22)
[DEBUG] 2020-03-09 19:24:48,002 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'tenantTestController'<class com.js.collection.web.modules.controllers.tenant.user.TenantTestController>
[DEBUG] 2020-03-09 19:24:48,003 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:391) - SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT * FROM sys_role  WHERE code=?) T WHERE ROWNUM <= 1) WHERE RN > 0 
    |        1 |
    |----------|
    | sysadmin |
  For example:> "SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT * FROM sys_role  WHERE code='sysadmin') T WHERE ROWNUM <= 1) WHERE RN > 0 "
[DEBUG] 2020-03-09 19:24:48,004 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT * FROM sys_role  WHERE code=?) T WHERE ROWNUM <= 1) WHERE RN > 0 , tables = []
[DEBUG] 2020-03-09 19:24:48,005 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:178) - not good for cache >> SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT * FROM sys_role  WHERE code=?) T WHERE ROWNUM <= 1) WHERE RN > 0 
[DEBUG] 2020-03-09 19:24:48,021 com.js.collection.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) - [GET ]URI=/tenant/test/get 19ms

写法:

dao.fetch("sys_role",Cnd.where("code","=","sysadmin"));

各位大神求理

6 回复

oracle下的query/fetch操作都需要分页, 支持得不好, 别的没问题

刚试了一下自定义的sql,虽然是单表,但也没啥用。如果想用query/fetch的话,加上分页就好了?还是说如果 用的是oracle的话,daocache就不要用了?

嗯, oracle就别用了

好绝情,好痛苦。

或者你能弄个oracle的分页函数?

wkcache 方法缓存不香么

添加回复
请先登陆
回到顶部