CacheDependency.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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("Constructor")]
  25. public CacheDependency(string filename)
  26. {
  27. }
  28. /// <remarks>
  29. /// Added by [email protected]
  30. /// </remarks>
  31. [MonoTODO("Constructor")]
  32. public CacheDependency(string[] filenames, string[] cachekeys)
  33. {
  34. }
  35. public delegate void CacheDependencyCallback(CacheDependency objDependency);
  36. public event CacheDependencyCallback Changed;
  37. public void OnChanged()
  38. {
  39. if (_boolDisposed)
  40. {
  41. throw new System.ObjectDisposedException("System.Web.CacheDependency");
  42. }
  43. if (Changed != null)
  44. {
  45. Changed(this);
  46. }
  47. }
  48. public bool IsDisposed
  49. {
  50. get
  51. {
  52. return _boolDisposed;
  53. }
  54. }
  55. public bool HasEvents
  56. {
  57. get
  58. {
  59. if (_boolDisposed)
  60. {
  61. throw new System.ObjectDisposedException("System.Web.CacheDependency");
  62. }
  63. if (Changed != null)
  64. {
  65. return true;
  66. }
  67. return false;
  68. }
  69. }
  70. public void Dispose()
  71. {
  72. _boolDisposed = true;
  73. }
  74. /// <summary>
  75. /// Used in testing.
  76. /// </summary>
  77. public void Signal()
  78. {
  79. OnChanged();
  80. }
  81. }
  82. }