CacheDependency.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // System.Web.Caching
  3. //
  4. // Author:
  5. // Patrik Torstensson ([email protected])
  6. //
  7. // (C) Copyright Patrik Torstensson, 2001
  8. //
  9. namespace System.Web.Caching
  10. {
  11. /// <summary>
  12. /// Class to handle cache dependency, right now this class is only a mookup
  13. /// </summary>
  14. public class CacheDependency : System.IDisposable
  15. {
  16. private bool _boolDisposed;
  17. public CacheDependency()
  18. {
  19. _boolDisposed = false;
  20. }
  21. /// <remarks>
  22. /// Added by [email protected]
  23. /// </remarks>
  24. [MonoTODO("Constrcutor")]
  25. public CacheDependency(string filename)
  26. {
  27. throw new NotImplementedException();
  28. }
  29. /// <remarks>
  30. /// Added by [email protected]
  31. /// </remarks>
  32. [MonoTODO("Constrcutor")]
  33. public CacheDependency(string[] filenames, string[] cachekeys)
  34. {
  35. throw new NotImplementedException();
  36. }
  37. public delegate void CacheDependencyCallback(CacheDependency objDependency);
  38. public event CacheDependencyCallback Changed;
  39. public void OnChanged()
  40. {
  41. if (_boolDisposed)
  42. {
  43. throw new System.ObjectDisposedException("System.Web.CacheDependency");
  44. }
  45. if (Changed != null)
  46. {
  47. Changed(this);
  48. }
  49. }
  50. public bool IsDisposed
  51. {
  52. get
  53. {
  54. return _boolDisposed;
  55. }
  56. }
  57. public bool HasEvents
  58. {
  59. get
  60. {
  61. if (_boolDisposed)
  62. {
  63. throw new System.ObjectDisposedException("System.Web.CacheDependency");
  64. }
  65. if (Changed != null)
  66. {
  67. return true;
  68. }
  69. return false;
  70. }
  71. }
  72. public void Dispose()
  73. {
  74. _boolDisposed = true;
  75. }
  76. /// <summary>
  77. /// Used in testing.
  78. /// </summary>
  79. public void Signal()
  80. {
  81. OnChanged();
  82. }
  83. }
  84. }