History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CACHE-88
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Andres March
Reporter: Eric Jain
Votes: 6
Watchers: 6
Operations

If you were logged in you would be able to see more operations.
OSCache

Don't create session object in cache tags unless necessary

Created: 28/May/04 12:43 PM   Updated: 10/Apr/05 04:26 AM
Component/s: Tags
Affects Version/s: 2.0.2
Fix Version/s: 2.1.1

Environment: Jetty 5.0
Issue Links:
Duplicate
 
This issue is duplicated by:
CACHE-134 <oscache:cache> always creates HttpSe... Major Closed


 Description  « Hide
Inserting the following into a JSP page will result in a session object to be created, even though the page states session = false.

<cache:cache key="test">
    Test
  </cache:cache>


 All   Comments   Change History      Sort Order:
Tim Craycroft - [09/Jun/04 02:46 PM ]
ServletCacheAdministrator.getCache() calls request.getSession(true) in order to get the ServletContext from the request. The ServletContext is needed to access the application-scope cache.

ServletCacheAdministrator instances don't refer directly back to their owning ServletContext, though since the model is one administrator per context, it seems reasonable to do so (unless I'm missing something), and to avoid creating a session to access the context.

Andres March - [27/Jan/05 03:40 PM ]
definitely, easy win

Lars Torunski - [28/Jan/05 12:39 PM ]
This improvement may change the behaviour of the application, because a session object isn't created anymore even if it wasn't necessary. A web application may react different to a not existing session object.

Hani Suleiman - [03/Feb/05 04:55 AM ]
I've committed a fix for this. The reason I think it's fine to have it in is that for anyone who uses a cache tag without specifically turning off sessions, one is created for the jsp page. So the only people who care are those who go out of their way to turn off sessions for a page, and they're the only people who need this fix.

Lars Torunski - [03/Feb/05 08:20 AM ]
Should we deprecate the method "public Cache getCache(HttpServletRequest request, int scope)"?

Because every FlushTag::doStartTag, ServletCacheAdministrator::cancelUpdate, getFromCache, putInCache and setCacheCapacity will still invoke getCache and a session object will be created.

The application should use "getSessionScopeCache" and "getAppScopeCache" instead.

Hani Suleiman - [09/Feb/05 04:03 PM ]
I dont think it should be deprecated. Another alternative is to have the admin object hold onto the servletContext, in which case the method could get at the app cache without going through the user session.

Bin Sun - [21/Feb/05 09:20 AM ]
As a workaround before 2.1.1 goes out, you may try my patch code described at http://jira.opensymphony.com/browse/CACHE-134