/**
   * 将缓存写入文件,如果文件存并且未过期在则直接返回该文件
   *
   * @param key
   * @param content
   * @param fileType
   * @param cacheDir
   * @param createDate
   * @return
   * @throws CacheException
   */
  public static CacheFile writeContent(
      String key, String content, Compressor.FileType fileType, String cacheDir, long createDate)
      throws CacheException {
    CacheFile file = findCacheFile(key, fileType, cacheDir);

    if (!file.getFile().exists() || file.getFile().lastModified() + 1000 < createDate) {
      logger.debug("尝试写入缓存文件....");
      File f = FileUtils.writeFile(content, file.getPath());
      logger.debug("写入缓存文件完毕!");
      return new SimpleCacheFile(f, fileType);
    }

    return file;
  }
 protected SimpleCache(String key, CacheType type, String dir) {
   this.cacheType = type;
   this.cacheDir = FileUtils.appendSeparator(dir);
   this.key = key;
 }