Example #1
0
        public void SavePersistsCache()
        {
            uut.Put("dp1", "flavour", "data1");
            uut.Put("dp2", "flavour", "data2");
            uut.Save();

            uut = new EngageCache(settings);
            Expect(uut.Get("dp1", "flavour"), Is.EqualTo("data1"));
            Expect(uut.Get("dp2", "flavour"), Is.EqualTo("data2"));
        }
Example #2
0
 override internal void OnApplicationPause(bool pauseStatus)
 {
     if (pauseStatus)
     {
         lastActive = DateTime.UtcNow;
         eventStore.FlushBuffers();
         engageCache.Save();
     }
     else
     {
         var backgroundSeconds = (DateTime.UtcNow - lastActive).TotalSeconds;
         if (backgroundSeconds > Settings.SessionTimeoutSeconds)
         {
             lastActive = DateTime.MinValue;
             NewSession();
         }
     }
 }