CachedVaryBy.cs 846 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // System.Web.Caching.CachedVaryBy
  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.Text;
  11. namespace System.Web.Caching {
  12. internal class CachedVaryBy {
  13. private string[] prms;
  14. private string[] headers;
  15. private string custom;
  16. internal CachedVaryBy (HttpCachePolicy policy)
  17. {
  18. prms = policy.VaryByParams.GetParamNames ();
  19. }
  20. internal string CreateKey (string file_path, HttpRequest request)
  21. {
  22. StringBuilder builder = new StringBuilder ();
  23. builder.Append (file_path);
  24. if (prms != null) {
  25. for (int i=0; i<prms.Length; i++) {
  26. builder.Append ("&VP:");
  27. builder.Append (prms [i]);
  28. builder.Append ('=');
  29. builder.Append (request.Params [prms [i]]);
  30. }
  31. }
  32. return builder.ToString ();
  33. }
  34. }
  35. }