title: implement jsp cache at "html level"
body: <p>I would like to implement a jsp cache at "html level". My idea is:</p>
  
  <pre><code>for each request{
    if(exists("/cache/&lt;product_id&gt;/&lt;product_name&gt;.html")){
      response "/cache/product/1234/cat.html"
    }else{
      response database.getCat("1234")
    }
  }
  
  exists(String path){
     if(!file(path)){
       return false;
     }else{
        if((currentDate = file(path).createdAt) &gt; CACHE_TIME){
           return false
        }else{
            return true
        }
     }
  }
  </code></pre>
  
  <p>So, as you can see only go to database (or another heavy process) if the page was not showed since  CACHE_TIME</p>
  
  <p>Example:</p>
  
  <p>User 1 go to <a href="http://mysite.com/products/1234/cat.jsp" rel="nofollow">http://mysite.com/products/1234/cat.jsp</a>
  Systems go to the database and generates an html file (products-1234-cat.html)
  User 1 see the page
  Immediately comes User 2 and go to the same url
  System sees that a cache exists, so response using products-1234-cat.html (no database, no heavy process).</p>
  
  <p>How can I implement this?</p>
  
  <p>I hope I was clear with what I want</p>