Advertisement
Guest User

пример идеи кеширования на jsp

a guest
Oct 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.82 KB | None | 0 0
  1. <!-- страница с кешированием -->
  2. <body>
  3.  
  4.     <startpack:cache liveMins="5">
  5.        
  6.         здесь все что угодно для данной страницы
  7.        
  8.     </startpack:cache>
  9.  
  10. </body>
  11.  
  12.  
  13. ---------------------------------------------------------------------
  14.  
  15. <!-- сам тег  startpack:cache -->
  16. <%@tag pageEncoding="UTF-8"%>
  17.  
  18. <!-- получаем предыдущий кеш рендера откуда нибудь -->
  19. <c:set var="oldContent" value="${fromCache}"/>
  20.  
  21. <!-- если кеш устарел, то выполняем тело и сохраняем в кеш -->
  22. <c:if test="${delta >= liveMins || fromCache == null}" >
  23.     <jsp:doBody var="body"/>
  24.     ${body}
  25.     ${fromCache = body}
  26. </c:if>
  27. <!-- если не устарел то юзаем его -->
  28. <c:else>
  29.     ${fromCache}
  30. </c:else>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement