c# - Saving a cache object when a WCF webservice is ended -
i have simple wcf webservice 2 methods : 1 save/updates obect in cache , other 1 deletes it. how can save object when close webservice server. using cacheitemremovedcallback doesn't work because object removed everytime update it. using global.asax.cs.application_end() doesn't work because cache cleared time here. using dispose() method method doesn't work because called every time call has finished. [servicecontract] public class webservice { [operationcontract] public void test(string message) { list<string> logs; logs = httpruntime.cache.get("logmessages") list<string>; if (logs == null) { logs = new list<string>(); logs.add(message); } else logs.add(message); httpruntime.cache.insert("logmessages", logs, null, cache.noabsoluteexpiration, cache.noslidingexpiration, cacheitempriority.notremovable, null); } [operationcontra...