VERTRIEB: 1-800-867-1380

 none
HELP in Session management in Table Storage

    Frage

  • Hi,

    I'm trying to implement Session Management in Table Storage using the TableStorageSessionStateProvider. I'm trying to cleanup the expired sessions using threads in the WebRole instead of the WorkerRole.

    I have a few doubts. The Session data is being stored in blobs, but there is only one entry in the Session Table which reflects only the last blob entry.

    How is the session table and blob container linked?

    As soon as i launch the application, there is a blob already present in the container even before i add any data to session. What is that?

    The code itself runs fine. I use the LastModifiedUTC property to check for expiry and delete the blobs like so:

     

    var blobarr = container.ListBlobs();

    foreach (CloudBlob blober in blobarr)

    {

         if (blober.Properties.LastModifiedUtc < DateTime.UtcNow.AddMinutes(-1))//Assuming one minute expiry timeout

         {

           Trace.WriteLine("Deleting " + blober.Properties.LastModifiedUtc.ToString() + "\n\n");                           

          blober.Delete();

           }

     }

    After all the session blobs have been cleaned up, of i try to add anything to session again, it shows a "blob not found" error.

    Has anybody implemeted clearing of expired sessions in table storage?

    Montag, 12. März 2012 12:58

Antworten

Alle Antworten