NutzCN Logo
问答 daocache缓存未生效
发布于 3027天前 作者 Rekoe 1861 次浏览 复制 上一个帖子 下一个帖子
标签:

发现 缓存好像没有生效 每次请求 查询 照样会查询数据库 会是哪里的问题?

var ioc = {
	gatheConf : {
		type : "org.nutz.ioc.impl.PropertiesProxy",
		fields : {
			paths : "gathe_core.properties"
		}
	},
	conf : {
		type : "org.nutz.ioc.impl.PropertiesProxy",
		fields : {
			paths : "conf.properties"
		}
	},
	dataSource : {
		type : "com.alibaba.druid.pool.DruidDataSource",
		events : {
			create : "init",
			depose : 'close'
		},
		fields : {
			url : {
				java : "$conf.get('db.url', 'jdbc:mysql://127.0.0.1:3306/platform?useUnicode=true&characterEncoding=utf-8')"
			},
			username : {
				java : "$conf.get('db.username', 'root')"
			},
			password : {
				java : "$conf.get('db.password', 'root')"
			},
			maxActive : {
				java : "$conf.getInt('db.maxActive', 20)"
			},
			validationQuery : "SELECT 'x'",
			testWhileIdle : true,
			testOnBorrow : false,
			testOnReturn : false,
			filters : "mergeStat",
			connectionProperties : "druid.stat.slowSqlMillis=1000"
		}
	},

	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 : [ "system_permission", "permission_category",
					"system_role", "system_user", "system_user_role",
					"article_category", "article" ],
			enableWhenTrans : false, // 事务作用域内不启用缓存,默认也是false
			db : "MYSQL"
		}
	},
	cacheProvider : {
		type : "org.nutz.plugins.cache.dao.impl.provider.EhcacheDaoCacheProvider",
		fields : {
			cacheManager : {
				refer : "cacheManager"
			}
		// 引用ehcache.js中定义的CacheManager
		},
		events : {
			create : "init"
		}
	}
};
9 回复

在MainSetup.init方法内加

CachedNutDaoExecutor.DEBUG = true;

就能打印详细日志了

@wendal
日志来了

2016-09-08 17:11:24,768 [DEBUG][org.nutz.mvc.impl.UrlMappingImpl] - Found mapping for [GET] path=/admin/article/list : AdminArticleAct.list(AdminArticleAct.java:39)
2016-09-08 17:11:24,796 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT COUNT(*) FROM article , tables = [article]
2016-09-08 17:11:24,796 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=570316604:_:_:SELECT COUNT(*) FROM article  SQL=SELECT COUNT(*) FROM article 
2016-09-08 17:11:24,820 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT COUNT(*) FROM article 
2016-09-08 17:11:24,820 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT COUNT(*) FROM article 
2016-09-08 17:11:24,824 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = select * from article  LIMIT 0, 20, tables = [article]
2016-09-08 17:11:24,824 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=-1557137917:1:20:select * from article  LIMIT 0, 20 SQL=select * from article  LIMIT 0, 20
2016-09-08 17:11:24,824 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = select * from article  LIMIT 0, 20
2016-09-08 17:11:24,826 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - select * from article  LIMIT 0, 20
2016-09-08 17:11:25,001 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,001 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,016 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,016 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,024 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,024 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,024 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,024 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,034 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,034 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,049 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,049 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,058 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,058 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,058 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,058 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,083 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,083 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,083 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,104 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,109 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,109 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,109 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,109 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,114 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,115 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=-194867173:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :2c7097caa2e342bdaf9904cf7001b8d7 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,115 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,116 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 2c7097caa2e342bdaf9904cf7001b8d7 |
  For example:> "SELECT * FROM article_category  WHERE id='2c7097caa2e342bdaf9904cf7001b8d7' LIMIT 0, 1 "
2016-09-08 17:11:25,121 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,121 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,121 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,121 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,125 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,126 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,126 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,126 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,130 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,130 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,130 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,130 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,135 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,135 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,135 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,135 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,152 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,153 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=-194867173:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :2c7097caa2e342bdaf9904cf7001b8d7 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,153 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,157 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 2c7097caa2e342bdaf9904cf7001b8d7 |
  For example:> "SELECT * FROM article_category  WHERE id='2c7097caa2e342bdaf9904cf7001b8d7' LIMIT 0, 1 "
2016-09-08 17:11:25,162 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,162 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,162 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,162 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,166 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,166 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,166 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,167 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,172 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,172 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,172 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,173 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,181 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,182 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,182 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,182 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,189 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,189 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=-194867173:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :2c7097caa2e342bdaf9904cf7001b8d7 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,189 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,191 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 2c7097caa2e342bdaf9904cf7001b8d7 |
  For example:> "SELECT * FROM article_category  WHERE id='2c7097caa2e342bdaf9904cf7001b8d7' LIMIT 0, 1 "
2016-09-08 17:11:25,196 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,196 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,196 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,196 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "
2016-09-08 17:11:25,201 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,201 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=-194867173:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :2c7097caa2e342bdaf9904cf7001b8d7 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,201 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,201 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 2c7097caa2e342bdaf9904cf7001b8d7 |
  For example:> "SELECT * FROM article_category  WHERE id='2c7097caa2e342bdaf9904cf7001b8d7' LIMIT 0, 1 "
2016-09-08 17:11:25,207 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - sql = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 , tables = [article_category]
2016-09-08 17:11:25,207 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - KEY=312665100:1:1:SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 :1196f77ce96a402c83e6b0e02a7a5611 SQL=SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,207 [DEBUG][org.nutz.plugins.cache.dao.CachedNutDaoExecutor] - cache miss = SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
2016-09-08 17:11:25,207 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM article_category  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 1196f77ce96a402c83e6b0e02a7a5611 |
  For example:> "SELECT * FROM article_category  WHERE id='1196f77ce96a402c83e6b0e02a7a5611' LIMIT 0, 1 "

ehcache.xml贴一下

@wendal

<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="false"
	monitoring="autodetect" dynamicConfig="true" name="rk_platform">
	<diskStore path="java.io.tmpdir/shiro-ehcache" />
	<!--<diskStore path="/data/yvr_cache/" /> -->
	<defaultCache maxElementsInMemory="1000" eternal="false"
		timeToIdleSeconds="3600" timeToLiveSeconds="3600" overflowToDisk="false"
		diskPersistent="false" diskExpiryThreadIntervalSeconds="120"
		statistics="false" />
	<cache name="shiro-activeSessionCache" maxElementsInMemory="1000"
		overflowToDisk="true" eternal="true" timeToLiveSeconds="0"
		timeToIdleSeconds="0" diskPersistent="true"
		diskExpiryThreadIntervalSeconds="600" />
</ehcache>

结贴 缓存的Entity 需要实现序列化

是不是用memory就不用实现序列化呢?

BasePojo implements Serializable 这样写一处就可以了吗?

@daodaovps 一般情况下是的

来自炫酷的 NutzCN

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