
| Key: |
CACHE-134
|
| Type: |
Improvement
|
| Status: |
Closed
|
| Resolution: |
Duplicate
|
| Priority: |
Major
|
| Assignee: |
Unassigned
|
| Reporter: |
Bin Sun
|
| Votes: |
0
|
| Watchers: |
1
|
|
If you were logged in you would be able to see more operations.
|
|
|
OSCache
Created: 27/Jan/05 12:13 AM
Updated: 27/Jan/05 03:35 PM
|
|
| Component/s: |
None
|
| Affects Version/s: |
2.1
|
| Fix Version/s: |
None
|
|
|
When I use oscache to cache a frequently visited page, and added
<%@page session="false" %>
in the head, I saw sessions still created.
When I trace session creation with a HttpSessionListener, I found the <oscache:cache> tag always creates the session, in the following code fragment of ServletCacheAdministrator.java:
public Cache getCache(HttpServletRequest request, int scope) {
if (scope == PageContext.APPLICATION_SCOPE) {
return getAppScopeCache(request.getSession(true).getServletContext());
}
if (scope == PageContext.SESSION_SCOPE) {
return getSessionScopeCache(request.getSession(true));
}
throw new RuntimeException("The supplied scope value of " + scope + " is invalid. Acceptable values are PageContext.APPLICATION_SCOPE and PageContext.SESSION_SCOPE");
}
Since the page is visited by enormous users, I want the session creation to be forbidden. Could OSCACHE improve this?
|
|
Description
|
When I use oscache to cache a frequently visited page, and added
<%@page session="false" %>
in the head, I saw sessions still created.
When I trace session creation with a HttpSessionListener, I found the <oscache:cache> tag always creates the session, in the following code fragment of ServletCacheAdministrator.java:
public Cache getCache(HttpServletRequest request, int scope) {
if (scope == PageContext.APPLICATION_SCOPE) {
return getAppScopeCache(request.getSession(true).getServletContext());
}
if (scope == PageContext.SESSION_SCOPE) {
return getSessionScopeCache(request.getSession(true));
}
throw new RuntimeException("The supplied scope value of " + scope + " is invalid. Acceptable values are PageContext.APPLICATION_SCOPE and PageContext.SESSION_SCOPE");
}
Since the page is visited by enormous users, I want the session creation to be forbidden. Could OSCACHE improve this? |
Show » |
|
com.opensymphony.oscache.web.CacheTag.java, inserted 1 line before line 444:
pageContext.getRequest().setAttribute("_ServletContext4OSCache_",pageContext.getServletContext());
com.opensymphony.oscache.web.ServletCacheAdministrator.java, modified line 220:
return getAppScopeCache((ServletContext) request.getAttribute("_ServletContext4OSCache_"));