Microsoft Enterprise Library caching application block the ICacheItemRefreshAction dosent fire RRS feed

  • Question

  • hello!!!

    i am using Microsoft Enterprise Library for the caching application block, i have an application that is suppose to load clients into the caching with an absolute expiration time defined in minutes.

    the idea is that when an item expires, the ICacheItemRefreshAction is suppose to run the refresh method and send an sms message via WCF.

    but the event doesn't fire on absolute time expiration or it works once and another time it dosent work. the code seems to be OK what am i doing wrong?

    this is the code

    int ReminderTime; int cacheExparationTime; string CellPhone;

      ObjCacheManager = CacheFactory.GetCacheManager("parkingCache");
      m_CacheInterval = TimerCache.CacheInterval;
      dt = DL.DataLayer.LoadToCache(SP_LOAD_CACHE, m_CacheInterval.ToString()).Tables[0];//UniParkDAL.DalManager.GetDataTable(SP_LOAD_CACHE, sqlParams);
      if (dt != null && dt.Rows.Count > 0)
        foreach (DataRow dr in dt.Rows)
          ReminderTime = Convert.ToInt32(dr["ReminderTime"]);
          CellPhone = CleanPhoneNumber(dr["Mobile"].ToString(), "972");
          TimeSpan DateDiff = DateTime.Parse(dr["IntervalEnd"].ToString()).Subtract(DateTime.Now);
          string Minutes = DateDiff.Minutes.ToString();
          if (ReminderTime > 0)
            cacheExparationTime = ReminderTime;
            ReminderTime = Convert.ToInt32(Minutes) - ReminderTime;
            m_message = string.Format("your parking will end in {0} minutes", ReminderTime.ToString());
            m_AbsoulteTime = new AbsoluteTime(TimeSpan.FromMinutes(cacheExparationTime));
            ObjCacheManager.Add(CellPhone, m_message, CacheItemPriority.Normal, new CallService(), m_AbsoulteTime);
    Sunday, June 5, 2011 10:11 AM