locked
Strange behavior with the ResetObjectTimeout method RRS feed

  • Question

  • Let's say I have this code :

          [TestMethod]
          public void TestMethod1 ()
          {
             const string TestKey = "TestKey";
             const string TestRegion = "Main";
    
             DataCache testCache = new DataCacheFactory ().GetCache ("TestCache");
             testCache.Remove (TestKey, TestRegion);
    
             testCache.Add (TestKey, new List<int> (), TimeSpan.FromMinutes (15), TestRegion);
    
             List<int> testData1 = (List<int>) testCache.Get (TestKey, TestRegion);
    //testCache.ResetObjectTimeout (TestKey, TimeSpan.FromMinutes (15), TestRegion); List<int> testData2 = (List<int>) testCache.Get (TestKey, TestRegion); Assert.AreSame (testData1, testData2); }
    The test will pass in beta 2. But if I remove the code in comment (ResetObjectTimeout), my Assert Fail. In CTP3, this wasn't the behavior. We implemented a sliding expiration by calling the ResetObjectTimeout at every get, but since beta 2 (we went from CTP3 to beta 2), the tests checking if our sliding expiration work fail because of this behavior.

    Does it mean the local cache is invalidated after the ResetObjectTimeout?
    Is there deserialization for every get? So I guess the performance will go down on big objects?
    Is this the expected behavior for the future or only a bug?

    Wednesday, March 17, 2010 12:21 PM

All replies

  • Hi, what is the configuration used for creating the cache factory? Do you have local cache on?

    For big objects, you could chunk them yourselves (if it is feasible).


    Amit. (Velocity Dev, MSFT)
    Wednesday, March 24, 2010 6:31 PM
  • This is my configuration: 

      <dataCacheClient requestTimeout="15000">
        <localCache isEnabled="true" sync="TTLBased" objectCount="100000" ttlValue="300" />
        <clientNotification pollInterval="300" />
        <hosts>
          <host name="localhost" cachePort="22233" />
        </hosts>
        <securityProperties mode="None" protectionLevel="None"/>
      </dataCacheClient>

    I'm not quite sure what chunk would help me with in this kind?

    Thursday, March 25, 2010 5:49 PM
  • So is this the expected behavior for the future or only a bug?

    And what is the difference with velocity for big / small objects?

    Friday, April 9, 2010 12:02 PM