You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Runtime.Caching;
  2. using iiie.CacheControl.DBO;
  3. namespace iiie.CacheControl.Business.OutputCache
  4. {
  5. public class MemoryOutputCache : IOutputCache
  6. {
  7. private static readonly MemoryCache Cache = MemoryCache.Default;
  8. public override CacheDbo Get(string key)
  9. {
  10. return Cache.Get(key) as CacheDbo;
  11. }
  12. public override void Remove(string key)
  13. {
  14. lock (Cache)
  15. {
  16. Cache.Remove(key);
  17. }
  18. }
  19. public override bool Contains(string key)
  20. {
  21. return Cache.Contains(key);
  22. }
  23. public override void Add(string key, CacheDbo o)
  24. {
  25. lock (Cache)
  26. {
  27. Cache.Add(key, o, new CacheItemPolicy());
  28. }
  29. }
  30. }
  31. }