HttpCachePolicyElement.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. //
  2. // System.Net.Configuration.HttpCachePolicyElement.cs
  3. //
  4. // Authors:
  5. // Tim Coleman ([email protected])
  6. //
  7. // Copyright (C) Tim Coleman, 2004
  8. // (c) 2004 Novell, Inc. (http://www.novell.com)
  9. //
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining
  12. // a copy of this software and associated documentation files (the
  13. // "Software"), to deal in the Software without restriction, including
  14. // without limitation the rights to use, copy, modify, merge, publish,
  15. // distribute, sublicense, and/or sell copies of the Software, and to
  16. // permit persons to whom the Software is furnished to do so, subject to
  17. // the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. //
  30. #if NET_2_0 && XML_DEP
  31. using System;
  32. using System.Configuration;
  33. using System.Net.Cache;
  34. using System.Xml;
  35. namespace System.Net.Configuration
  36. {
  37. public sealed class HttpCachePolicyElement : ConfigurationElement
  38. {
  39. #region Fields
  40. ConfigurationPropertyCollection properties;
  41. static ConfigurationProperty maximumAge = new ConfigurationProperty ("MaximumAge", typeof (TimeSpan), TimeSpan.MaxValue);
  42. static ConfigurationProperty maximumStale = new ConfigurationProperty ("MaximumStale", typeof (TimeSpan), TimeSpan.MinValue);
  43. static ConfigurationProperty minimumFresh = new ConfigurationProperty ("MinimumFresh", typeof (TimeSpan), TimeSpan.MinValue);
  44. static ConfigurationProperty policyLevel = new ConfigurationProperty ("PolicyLevel", typeof (HttpRequestCacheLevel), HttpRequestCacheLevel.Default);
  45. #endregion // Fields
  46. #region Constructors
  47. public HttpCachePolicyElement ()
  48. {
  49. properties = new ConfigurationPropertyCollection ();
  50. properties.Add (maximumAge);
  51. properties.Add (maximumStale);
  52. properties.Add (minimumFresh);
  53. properties.Add (policyLevel);
  54. }
  55. #endregion // Constructors
  56. #region Properties
  57. public TimeSpan MaximumAge {
  58. get { return (TimeSpan) base [maximumAge]; }
  59. set { base [maximumAge] = value; }
  60. }
  61. public TimeSpan MaximumStale {
  62. get { return (TimeSpan) base [maximumStale]; }
  63. set { base [maximumStale] = value; }
  64. }
  65. public TimeSpan MinimumFresh {
  66. get { return (TimeSpan) base [minimumFresh]; }
  67. set { base [minimumFresh] = value; }
  68. }
  69. public HttpRequestCacheLevel PolicyLevel {
  70. get { return (HttpRequestCacheLevel) base [policyLevel]; }
  71. set { base [policyLevel] = value; }
  72. }
  73. protected internal override ConfigurationPropertyCollection Properties {
  74. get { return properties; }
  75. }
  76. #endregion // Properties
  77. #region Methods
  78. [MonoTODO]
  79. protected internal override void Deserialize (XmlReader reader, bool serializeCollectionKey)
  80. {
  81. throw new NotImplementedException ();
  82. }
  83. [MonoTODO]
  84. protected internal override void Reset (ConfigurationElement parentElement, object context)
  85. {
  86. throw new NotImplementedException ();
  87. }
  88. #endregion // Methods
  89. }
  90. }
  91. #endif