Replace asp session with Memcached

Dawei Wang dawei.wang at iupload.com
Tue May 8 15:50:24 UTC 2007


Hi,All:

I am currently working on Replace asp session with Memcached, has anyone
worked on this before and can give me some idea about this?

Thanks a lot.

We have more than one webserver and more than one applications on each
server... and following is my thought and some problems ,if anyone can help
me out,  that would be really cool...

To replace session with Memcached, we have two problems need to figure out:
*
1. Key for Session*

We all know that asp session is saved for each application, so we can use
session("user_id"), all applications will works fine because session is
stored in different place for dirrerent application.
but in memcache, all will be saved to the same place : memcached server, so
we have to make sure the key is unique.

solution: use sessionID as key prex to implement this.

In our current system, session is stored in one webserver, if switching to
another webserver, session will lose. we need to make sure all webservers
get the same key for the same website.

solution: store sessionID in cookie, even webserver is changed, cookie is
still there, so SessionID is not changed, then session varables saved in
memcached will not lose.

How to simulate the behavior as asp session?

solution: set all session values in memcached to expire in 24 hours,
and sessionID
saved in cookie expires when browser is closed ( this is default) or we can
set sessionID saved in cookie never expired for special communities.

When any page in the application is loaded , we should set all the related
session varibles in Memcached to expire in another 24 hours, how can we
implement this?

solution: write a single page which is included by all pages in this
application, in this page, first get sessionID ,then update all session
varibles whose key starts with sessionID. but Memcached API does not apply
search key function, we have to figure out this....

*2. Override Asp Session object*

We don't want to change our current code, so we need to override asp session
object, we need to figure out how to implement the following without
changing code:

session("a") = "a" & session("a")

solution: ???


-- 
Dawei Wang
iUpload(r) | www.iupload.com | 1-866-487-5623

Blog:  http://wang.iupload.com/
Email: dawei.wang at iupload.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20070508/fdee82f3/attachment.htm


More information about the memcached mailing list