1234567891011121314151617181920212223242526272829303132333435 |
- using System.Runtime.Caching;
-
- namespace iiie.CacheControl.Business.OutputCache
- {
- public class MemoryOutputCache : IOutputCache
- {
- private static readonly MemoryCache Cache = MemoryCache.Default;
-
- public override object Get(string key)
- {
- return Cache.Get(key);
- }
-
- public override void Remove(string key)
- {
- lock (Cache)
- {
- Cache.Remove(key);
- }
- }
-
- public override bool Contains(string key)
- {
- return Cache.Contains(key);
- }
-
- public override void Add(string key, object o)
- {
- lock (Cache)
- {
- Cache.Add(key, o, new CacheItemPolicy());
- }
- }
- }
- }
|