code_junkie

One Cache for various Applications

Nov 13th, 2011
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. public static System.Web.Caching.Cache Cache
  2. {
  3. get
  4. {
  5. if(cache == null)
  6. {
  7. if (System.Web.HttpContext.Current != null)
  8. {
  9. //asp.net
  10. cache = System.Web.HttpContext.Current.Cache;
  11. }
  12. else
  13. {
  14. //windows service
  15. cache = System.Web.HttpRuntime.Cache;
  16. }
  17. }
  18. return cache;
  19. }
  20. }
Add Comment
Please, Sign In to add comment