NutzCN Logo
问答 为啥会打印这样的日志
发布于 2349天前 作者 qq_64f81159 1566 次浏览 复制 上一个帖子 下一个帖子
标签:
[DEBUG] 2017-11-17 16:17:28,761 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:17:46,257 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:17:53,723 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:17:57,671 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:17:58,999 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:21,975 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:22,759 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:23,215 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:23,680 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:23,912 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:24,159 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:24,471 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:24,904 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:25,143 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:25,399 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:25,679 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:26,047 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:27,697 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:28,304 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:28,592 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:28,983 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:29,197 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:29,384 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:29,575 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:29,719 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=0p1utdfdmajm3r4l7oeu4mc0ce:2e5b02a8-348e-43bb-8536-1e85b7948ff3
[DEBUG] 2017-11-17 16:18:30,208 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM sys_role  LIMIT 0, 10 
[DEBUG] 2017-11-17 16:18:30,210 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT COUNT(*) FROM sys_role 
[DEBUG] 2017-11-17 16:18:30,212 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [POST]URI=/nutzwk/platform/sys/role/list 74766ms

我用nutzwk的配置,把角色列表显示出来,每一次后台打印都是这样的,为啥有这么多onPMessage,另外我发现还是会发sql语句捏 这里哪里体现缓存这块啊!配置文件用的是nutzwk一致的,是不是哪里没有配置的原因

25 回复

改一下对应package的日志级别就不显示啦

至于sql为啥打印,应该是dao.json里面缓存表没写上这个表

不是显示的问题。我是想知道为什么这么频繁的访问redis。。。另外貌似没有用到缓存 每次刷新的时候还是会查询数据库

    dao : {
            type : "org.nutz.dao.impl.NutDao", 
            args : [{refer:"dataSource"}],
            fields : {
                interceptors : [{refer:"cacheExecutor"}, "log"]
            }
        },
        cacheExecutor : {
            type : "org.nutz.plugins.cache.dao.DaoCacheInterceptor",
            fields : {
                cacheProvider : {refer:"cacheProvider"},
                // 需要缓存的表名
                cachedTableNames : ["t_user_profile",
                                    //"t_user", "t_role", "t_permission", "t_role_permission"
                                    ]
            }
        },
        // 基于Ehcache的DaoCacheProvider
        cacheProvider : {
            type : "org.nutz.plugins.cache.dao.impl.provider.EhcacheDaoCacheProvider",
            fields : {
                cacheManager : {refer:"cacheManager"} // 引用ehcache.js中定义的CacheManager
            },
            events : {
                create : "init"
            }
        }

需要缓存的表名 写了 怎么没有缓存呢

var ioc = {
		conf : {
			type : "org.nutz.ioc.impl.PropertiesProxy",
			fields : {
				paths : ["config/custom/"]
			}
		},
	    dataSource : {
			factory : "$conf#make",
			args : ["com.alibaba.druid.pool.DruidDataSource", "db."],
	        type : "com.alibaba.druid.pool.DruidDataSource",
	        events : {
	        	create : "init",
	            depose : 'close'
	        }
	    },
		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"]
			}
		},
		// 基于Ehcache的DaoCacheProvider
		cacheProvider : {
			type : "org.nutz.plugins.cache.dao.impl.provider.EhcacheDaoCacheProvider",
			fields : {
				cacheManager : {refer:"cacheManager"} // 引用ehcache.json中定义的CacheManager
			},
			events : {
				create : "init"
			}
		}
};

这是我的dao.json 里面有这个表名。

*jedis我没有写 这个代表啥意思。

另外
public void onPMessage(String pattern, String channel, String message) {
log.debugf("channel=%s, msg=%s", channel, message);
if (message.startsWith(LCacheManager.me.id))
return;
String cacheName = channel.substring(LCacheManager.PREFIX.length());
LCache cache = LCacheManager.me.caches.get(cacheName);
if (cache != null && cache.list.size() > 1)
((Cache) cache.list.get(0)).remove(message.substring(LCacheManager.me.id.length() + 1));
}

这个方法是接收到订阅消息,就删除level1中ehcache中的缓存?这个删除没看到依据什么情况删啊,
if (message.startsWith(LCacheManager.me.id))
return;
这里为啥要return?

session有变更就会发通知,触发onPMessage

我猜你在web.xml里面配的是原始的ShiroFilter,它在每个请求进来的时候都会touch一下session,修改最后访问时间,导致session变更

配成shiro插件里面的ShiroFilter2应该能解决

改成shiro插件了 没用频繁onPMessage了 但是貌似没有用到缓存,还是每次从数据库查 我看nutzbook里面basemodule中
@Inject
protected CacheManager cacheManager;
是不是一定要手动注入cacheManager才能用到缓存?

CachedNutDaoExecutor有个DEBUG开关,启用一下, 看看输出什么日志

打开开关以后载入页面刷新以后的后台日志

[DEBUG] 2017-11-17 17:03:08,921 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/sys/role/index : RoleController.index(RoleController.java:35)
[DEBUG] 2017-11-17 17:03:08,921 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) - Get 'roleController'<class com.kanq.controller.sys.RoleController>
[DEBUG] 2017-11-17 17:03:08,922 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/nutzwk/platform/sys/role/index 1ms
[DEBUG] 2017-11-17 17:03:10,009 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [POST] path=/platform/sys/role/list : RoleController.list(RoleController.java:40)
[DEBUG] 2017-11-17 17:03:10,009 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) - Get 'roleController'<class com.kanq.controller.sys.RoleController>
[DEBUG] 2017-11-17 17:03:10,010 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM sys_role  LIMIT 0, 10 
[DEBUG] 2017-11-17 17:03:10,011 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:147) - sql = SELECT * FROM sys_role  LIMIT 0, 10 , tables = [sys_role]
[DEBUG] 2017-11-17 17:03:10,011 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:158) - KEY=-2023161690:1:10:SELECT * FROM sys_role  LIMIT 0, 10  SQL=SELECT * FROM sys_role  LIMIT 0, 10 
[DEBUG] 2017-11-17 17:03:10,012 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:164) - cache found key=-2023161690:1:10:SELECT * FROM sys_role  LIMIT 0, 10 
[DEBUG] 2017-11-17 17:03:10,014 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT COUNT(*) FROM sys_role 
[DEBUG] 2017-11-17 17:03:10,015 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:147) - sql = SELECT COUNT(*) FROM sys_role , tables = [sys_role]
[DEBUG] 2017-11-17 17:03:10,016 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:158) - KEY=480429926:_:_:SELECT COUNT(*) FROM sys_role  SQL=SELECT COUNT(*) FROM sys_role 
[DEBUG] 2017-11-17 17:03:10,016 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:164) - cache found key=480429926:_:_:SELECT COUNT(*) FROM sys_role 
[DEBUG] 2017-11-17 17:03:10,018 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [POST]URI=/nutzwk/platform/sys/role/list 9ms

这个算是找到cache了?这个是从缓存里面读取的?

我刷新一次 为啥会查询两次。
[DEBUG] 2017-11-17 17:03:10,010 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM sys_role LIMIT 0, 10
[DEBUG] 2017-11-17 17:03:10,011 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:147) - sql = SELECT * FROM sys_role LIMIT 0, 10 , tables = [sys_role] [DEBUG] 2017-11-17 17:03:10,011 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:158) - KEY=-2023161690:1:10:SELECT * FROM sys_role LIMIT 0, 10 SQL=SELECT * FROM sys_role LIMIT 0, 10
[DEBUG] 2017-11-17 17:03:10,012 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:164) - cache found key=-2023161690:1:10:SELECT * FROM sys_role LIMIT 0, 10
[DEBUG] 2017-11-17 17:03:10,014 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT COUNT(*) FROM sys_role
[DEBUG] 2017-11-17 17:03:10,015 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:147) - sql = SELECT COUNT(*) FROM sys_role , tables = [sys_role] [DEBUG] 2017-11-17 17:03:10,016 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:158) - KEY=480429926:_:_:SELECT COUNT(*) FROM sys_role SQL=SELECT COUNT(*) FROM sys_role
[DEBUG] 2017-11-17 17:03:10,016 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:164) - cache found key=480429926:_:_:SELECT COUNT(*) FROM sys_role
[DEBUG] 2017-11-17 17:03:10,018 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [POST]URI=/nutzwk/platform/sys/role/list 9ms

那你没配对了,仔细看文档

新版需要配成拦截器模式

//executor : {refer:"cacheExecutor"} // executor是1.r.57.r3及以下版本的写法.
interceptors : [{refer:"cacheExecutor"}, "log"] // 这是1.r.58及以上的写法
就这个地方改了啊,我改了以后 每次刷新都是

[DEBUG] 2017-11-17 17:37:15,674 org.nutz.plugins.cache.impl.redis.RedisCache2.put(RedisCache2.java:46) - SET key=shiro-activeSessionCache:b4a030f3-bed3-4235-bfaa-13b062cea453
[DEBUG] 2017-11-17 17:37:15,678 org.nutz.plugins.cache.impl.lcache.LCache.fire(LCache.java:96) - fire channel=LCache:shiro-activeSessionCache msg=46dkvqtfbiia4opc81pietc5f1:b4a030f3-bed3-4235-bfaa-13b062cea453
[DEBUG] 2017-11-17 17:37:15,679 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=46dkvqtfbiia4opc81pietc5f1:b4a030f3-bed3-4235-bfaa-13b062cea453
[DEBUG] 2017-11-17 17:37:15,679 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/sys/role/index : RoleController.index(RoleController.java:35)
[DEBUG] 2017-11-17 17:37:15,680 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) - Get 'roleController'<class com.kanq.controller.sys.RoleController>
[DEBUG] 2017-11-17 17:37:15,681 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/nutzwk/platform/sys/role/index 0ms
[DEBUG] 2017-11-17 17:37:16,839 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [POST] path=/platform/sys/role/list : RoleController.list(RoleController.java:40)
[DEBUG] 2017-11-17 17:37:16,840 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) - Get 'roleController'<class com.kanq.controller.sys.RoleController>
[DEBUG] 2017-11-17 17:37:16,841 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM sys_role  LIMIT 0, 10 
[DEBUG] 2017-11-17 17:37:16,843 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT COUNT(*) FROM sys_role 
[DEBUG] 2017-11-17 17:37:16,844 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [POST]URI=/nutzwk/platform/sys/role/list 4ms

貌似还是木有用到缓存。

var ioc = {
		conf : {
			type : "org.nutz.ioc.impl.PropertiesProxy",
			fields : {
				paths : ["config/custom/"]
			}
		},
	    dataSource : {
			factory : "$conf#make",
			args : ["com.alibaba.druid.pool.DruidDataSource", "db."],
	        type : "com.alibaba.druid.pool.DruidDataSource",
	        events : {
	        	create : "init",
	            depose : 'close'
	        }
	    },
		dao : {
			type : "org.nutz.dao.impl.NutDao",
			args : [{refer:"dataSource"}],
			fields : {
				interceptors : [{refer:"cacheExecutor"}, "log"]
			}
		},
		cacheExecutor : {
			type : "org.nutz.plugins.cache.dao.CachedNutDaoExecutor",
			fields : {
				DEBUG:true
				cacheProvider : {refer:"cacheProvider"},
				cachedTableNames : ["sys_user", "sys_role", "sys_menu"]
			}
		},
		// 基于Ehcache的DaoCacheProvider
		cacheProvider : {
			type : "org.nutz.plugins.cache.dao.impl.provider.EhcacheDaoCacheProvider",
			fields : {
				cacheManager : {refer:"cacheManager"} // 引用ehcache.json中定义的CacheManager
			},
			events : {
				create : "init"
			}
		}
};

配置文件是这样的了。

var ioc = {
		conf : {
			type : "org.nutz.ioc.impl.PropertiesProxy",
			fields : {
				paths : ["config/custom/"]
			}
		},
	    dataSource : {
			factory : "$conf#make",
			args : ["com.alibaba.druid.pool.DruidDataSource", "db."],
	        type : "com.alibaba.druid.pool.DruidDataSource",
	        events : {
	        	create : "init",
	            depose : 'close'
	        }
	    },
		dao : {
			type : "org.nutz.dao.impl.NutDao",
			args : [{refer:"dataSource"}],
			fields : {
				interceptors : [{refer:"cacheExecutor"}, "log"]
			}
		},
		cacheExecutor : {
			type : "org.nutz.plugins.cache.dao.CachedNutDaoExecutor",
			fields : {
				DEBUG:true
				cacheProvider : {refer:"cacheProvider"},
				cachedTableNames : ["sys_user", "sys_role", "sys_menu"]
			}
		},
		// 基于Ehcache的DaoCacheProvider
		cacheProvider : {
			type : "org.nutz.plugins.cache.dao.impl.provider.MemoryDaoCacheProvider",
			fields : {
				cacheSize : 10000
			},
			events : {
				create : "init"
			}
		}
};

我把cacheProvider 换成基于内存的貌似也是一样的。

这个换成啥貌似也没用到缓存。

改成拦截器之后,第二次查询没有sql出来就行啦

就是第二次查询有sql啊

dao : {
			type : "org.nutz.dao.impl.NutDao",
			args : [{refer:"dataSource"}],
			fields : {
				interceptors : [{refer:"cacheExecutor"}, "log"]
			}
		},
		cacheExecutor : {
			type : "org.nutz.plugins.cache.dao.CachedNutDaoExecutor",
			fields : {
				DEBUG:true
				cacheProvider : {refer:"cacheProvider"},
				cachedTableNames : ["sys_user", "sys_role", "sys_menu"]
			}
		},

interceptors : [{refer:"cacheExecutor"}, "log"]这样写是否有问题啊 ?因为我看执行过程 并没有经过CachedNutDaoExecutor,直接经过了NutDaoExecutor

你再仔细对照文档

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