public void RemoveCustomerInfofromCache(string key, CacheItem cacheItem)
 {
     // deleted entire info of a customer from database and cache
     try
     {
         WriteThruOptions options = new WriteThruOptions(WriteMode.WriteBehind);
         cache.DataTypeManager.Remove(key, writeThruOptions: options);
     }
     catch
     {
         throw;
     }
 }
 // add a customer info in cache
 public void AddtCustomerInCache(string key, DataTypeAttributes attributes, FraudRequest customer)
 {
     try
     {
         // create a list with write behind option
         // so whenever a cahcnge happen in data it is upadated back to data source
         WriteThruOptions options             = new WriteThruOptions(WriteMode.WriteBehind);
         IDistributedList <FraudRequest> list = cache.DataTypeManager.CreateList <FraudRequest>(key, attributes);
         list.WriteThruOptions = options;
         list.Add(customer);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="cacheName">name of cache</param>
        /// <param name="readThruProviderName">readthru provider name</param>
        /// <param name="writeThruProviderName">writethru provider name</param>
        public StoreHandler(string cacheName, string readThruProviderName, string writeThruProviderName)
        {
            // initialize cache
            _cache = CacheManager.GetCache(cacheName);

            // assign null to provider names if empty provider names are received
            if (readThruProviderName.Equals(string.Empty))
            {
                readThruProviderName = null;
            }
            if (writeThruProviderName.Equals(string.Empty))
            {
                writeThruProviderName = null;
            }

            // initialize read/write thru options for later use
            readThruOptions  = new ReadThruOptions(ReadMode.ReadThru, readThruProviderName);
            writeThruOptions = new WriteThruOptions(WriteMode.WriteThru, writeThruProviderName);
        }
 public void UpdateCustomerInfoInCache(string key, FraudRequest cutomerInfo)
 {
     try
     {
         // update info of a customer aginst its id
         WriteThruOptions options             = new WriteThruOptions(WriteMode.WriteBehind);
         IDistributedList <FraudRequest> list = cache.DataTypeManager.GetList <FraudRequest>(key);
         if (list == null)
         {
             AddtCustomerInCache(key, null, cutomerInfo);
         }
         else
         {
             list.WriteThruOptions = options;
             list.Add(cutomerInfo);
         }
     }
     catch
     {
         throw;
     }
 }