7digital / SevenDigital.Api.Wrapper

A fluent c# wrapper for the 7digital API
MIT License
16 stars 29 forks source link

Response cache keeps the parsed object #165

Closed AnthonySteele closed 10 years ago

AnthonySteele commented 10 years ago

Response cache keeps the parsed object rather than parsing the cached request each time

keeping the result of the parse instead of the response text and headers will be faster and small

raoulmillais commented 10 years ago

This will break existing caches without flushing as the key may not have changed but the expected cached item has. Not necessarily a problem, but it would be a good idea to document that in the readme I.E. that consumers will need to flush any caches after upgrading.

AnthonySteele commented 10 years ago

Good point, I hadn't thought of that.

Though, the wrapper package doesn't actually supply a working implementation of the cache, just the interface and a null version. The client code that implements a working cache will have to deal with this, e.g. return "not found" if the cached object was found but is not of the correct type which could happen if the cache was not not flushed and objects of type Response are still in there. If you know to do it, it's not a lot of code, e.g. a simple "as" cast.