DefconDotNet

Untitled

Feb 7th, 2012
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System.Web;
  2.  
  3. namespace Freelancers.Infrastructure.Storage
  4. {
  5.     public class CacheStorage : ICacheStorage
  6.     {
  7.         public void Remove(string key)
  8.         {
  9.             Ensure.Argument.NotNullOrEmpty(key, "key");
  10.            
  11.             HttpContext.Current.Cache.Remove(key);
  12.         }
  13.  
  14.         public void Store(string key, object data)
  15.         {
  16.             Ensure.Argument.NotNullOrEmpty(key, "key");
  17.             Ensure.Argument.NotNull(data, "data");
  18.  
  19.             HttpContext.Current.Cache.Insert(key, data);
  20.         }
  21.  
  22.         public T Retrieve<T>(string key) where T : class
  23.         {
  24.             Ensure.Argument.NotNullOrEmpty(key, "key");
  25.  
  26.             return (T)HttpContext.Current.Cache.Get(key);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment