RemoteStateServer.cs 974 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // System.Web.SessionState.RemoteStateServer
  3. //
  4. // Author(s):
  5. // Jackson Harper ([email protected])
  6. //
  7. // (C) 2003 Novell, Inc (http://www.novell.com)
  8. //
  9. using System;
  10. using System.Collections;
  11. namespace System.Web.SessionState {
  12. internal class RemoteStateServer : MarshalByRefObject {
  13. private Hashtable table;
  14. internal RemoteStateServer ()
  15. {
  16. table = new Hashtable ();
  17. }
  18. internal void Insert (string id, StateServerItem item)
  19. {
  20. table.Add (id, item);
  21. }
  22. internal void Update (string id, byte [] dict_data, byte [] sobjs_data)
  23. {
  24. StateServerItem item = table [id] as StateServerItem;
  25. if (item == null)
  26. return;
  27. item.DictionaryData = dict_data;
  28. item.StaticObjectsData = sobjs_data;
  29. item.Touch ();
  30. }
  31. internal StateServerItem Get (string id)
  32. {
  33. StateServerItem item = table [id] as StateServerItem;
  34. if (item == null || item.IsAbandoned ())
  35. return null;
  36. item.Touch ();
  37. return item;
  38. }
  39. }
  40. }