title: Reduce file cache in java
body: <p>I am working on a web service(web project) written in java using the tomcat server. I have written some code for reading the content of the file &amp; create a hash of this file. The file is getting updated daily, I want the hash to to be updated daily too. But this is not happening until I reload the web service explicitly via tomcat server. </p>
  
  <p>Is there any way to reduce the cache time of the hash or should the hash be created freshly irrespective of a external reload command? </p>
  
  <p>This is how i am reading the file:</p>
  
  <pre><code>static Map&lt;String, Object&gt; mcatFullDataHash;
  BufferedReader br = new BufferedReader(new FileReader("mcat_group.tsv"));
  while ((line = br.readLine()) != null)
  {
      HashMap&lt;String, Object&gt; mcatInfo = new HashMap&lt;String, Object&gt;();
      line_elements = line.split("\\t");
      mcatInfo.put("groupid",line_elements[2]);
      mcatInfo.put("catid",line_elements[1]);
      mcatInfo.put("no_to_show_mcat", line_elements[4]);
      mcatFullData.put(line_elements[0],mcatInfo);
  }
  </code></pre>
  
  <p>mcatFullDataHash is the hash from where I am reading the contents.</p>