Zeus User Community
Independent community for users of Zeus Technologies products.
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 29, 2010, 07:43:42 PM


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Delete session persistence?  (Read 2736 times)
dward
Newcomer
*
Posts: 1


View Profile Email
« on: October 12, 2007, 04:17:17 PM »

Is there anyway to delete a persistence key or at least set a timeout for the key?
Logged
michael
Senior
***
Posts: 21


View Profile
« Reply #1 on: November 14, 2007, 07:15:45 PM »

No, there isn't.  The only way for entries to get kicked out is by not being used while new entries are added to the system.  When the capacity of the cache is reached, the entry which hasn't been used longest is removed to make space for new entries.

The cache size can be set via System- > Global Settings -> Cache Settings.

Logged
Owen
Expert
****
Posts: 31


View Profile WWW
« Reply #2 on: November 21, 2007, 02:16:40 PM »

You can index the session persistence with a cookie; then deleting the cookie will be sufficient to make ZXTM 'forget' the session persistence.  Depending on the application, you may be able to use a cookie that the application sets, or you can create your own cookie specially for this purpose.

For example, suppose that you want to persist all jsp pages to the same back-end server, but 'forget' the session persistence once the user accesses the 'logout.jsp' page.  Something like the following, using a 'Universal Session Persistence' class, might do the trick:


$url = http.getPath();

# We're only interested in .jsp pages
if( ! string.endswith( $url, ".jsp" ) ) break;

# Get the session persistence cookie
$cookie = http.getCookie( "MySession" );

# If the user hasn't got a cookie (i.e. first time in, or we've deleted the session persistence)
# create a new, random cookie.
if( ! $cookie ) {
   $rand = math.random( 0xfffffff ) . sys.time() . request.getRemoteIP();
   $cookie = string.hexencode( string.hashMD5( $rand ) );

   http.setResponseCookie( "MySession", $cookie );
}

if( $url == "/logout.jsp" ) {
   # Clear the cookie in the response, so that next time in we create a new one
   http.setResponseCookie( "MySession", "" );
}

# Persist on the value of the cookie
connection.setPersistenceKey( $cookie );
connection.setPersistence( "My Session Persistence Class" );
Logged

Owen Garrett
Product Management, Zeus Technology, http://www.zeus.com/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC

Images and graphics used with permission of Zeus Technology.
Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM