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

  • Question

  • User1846520833 posted

    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 6:16 AM

Answers

  • User1846520833 posted

    i found the problem, it wasent the callback method it was the expiration policy it was defined on universal time so i created a new class and inherted the expiration interface and created a new time policy with local time. and now it works beautiful

    thank you for your help

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 8, 2011 2:07 AM

All replies