public void TestAging() { var buffer = new ByteBufferPool(10, new int[] { 1 }, 1); Assert.AreEqual(0, buffer.AllocatedBytes); var bytes = buffer.LeaseBytes(1); buffer.ReturnBytes(bytes); Assert.AreEqual(1, buffer.AllocatedBytes); System.Threading.Thread.Sleep(1000); buffer.Maintain(); Assert.AreEqual(0, buffer.AllocatedBytes); }
/// <summary> /// Should be called periodically to run cleanup tasks on data /// that has aged out /// </summary> public void Maintain() { _assetCache.Maintain(); _bufferPool.Maintain(); }