2017-02-06 10:47
源码中这样写到:
//2.0 这样的__________________________________________
public FileRender(File file) {
this.file = file;
}
public FileRender(String fileName) {
fileName = fileName.startsWith("/") ? webRootPath + fileName : fileDownloadPath + fileName;
this.file = new File(fileName);
}
//3.0 这样的__________________________________________
public FileRender(File file) {
if (file == null) {
throw new IllegalArgumentException("file can not be null.");
}
this.file = file;
}
public FileRender(String fileName) {
if (StrKit.isBlank(fileName)) {
throw new IllegalArgumentException("fileName can not be blank.");
}
String fullFileName;
fileName = fileName.trim();
if (fileName.startsWith("/") || fileName.startsWith("\\")) {
if (baseDownloadPath.equals("/")) {
fullFileName = fileName;
} else {
fullFileName = baseDownloadPath + fileName;
}
} else {
fullFileName = baseDownloadPath + File.separator + fileName;
}
this.file = new File(fullFileName);
}
2017-02-06 10:34
@杜福忠 ps: 不要put, 只remove就可以了, 源码中已经put了,
/**
* Find model by cache.
* @see #find(String, Object...)
* @param cacheName the cache name
* @param key the key used to get data from cache
* @return the list of Model
*/
public List findByCache(String cacheName, Object key, String sql, Object... paras) {
ICache cache = getConfig().getCache();
List result = cache.get(cacheName, key);
if (result == null) { // 这里
result = find(sql, paras);
cache.put(cacheName, key, result); // 这里
}
return result;
}