查询 缓存

@SuppressWarnings("unchecked")
	@Cacheable(value = "com.broadwave.service.prefs", key = "#pkg.getContext().concat('-').concat(#pkg.getPackageName())")
	public List<PrefObject> getProperties(PackageName pkg) {
		pkg.getContext().concat("-").contains(pkg.getPackageName());
		List<? extends PrefObject> results = getJdbcTemplate().query("select * from " + userPrefValue + " where parent = ? and pkg = ? order by name asc", valueMapper,
				pkg.getPackageName(), pkg.getName());
		return (List<PrefObject>) results;
	}

取消缓存

@CacheEvict(value = "com.broadwave.service.prefs", allEntries = true)
	public int deleteValues(PackageName pkg) {
		int update = getJdbcTemplate().update("delete from " + userPrefValue + " where parent = ? and pkg=?", pkg.getContext(), pkg.getPackageName());
		return update;
	}





你可能感兴趣的:(查询 缓存)