I’ve got a really hard time to try disabling caching in the Restkit framework.
I’ve try to put the cache policy to none, with no effect at all. What’s the correct way to do this?
I’ve got a really hard time to try disabling caching in the Restkit framework.
Share
So once you’ve got a client, either explicitly initializing it:
or by letting the object manager do it:
It should be a simple matter of just setting the cache policy:
Was that what you were doing?
Update: Since the logging message is the only thing worrying I decided to track down its source. The tl;dr version is to ignore the message and trust what the logging proxy is telling you.
To double check I searched for “Invalidating cache at path” and found it in two locations
RKCache invalidateSubDirectory:andRKCache invalidateAlland set break points on them. Here’s a partial stack trace from some of my code:What I learned looking through this is that there are two enums that control caching:
RKRequestCachePolicywhich is what you set on the client, it controls when the cache is consulted.RKRequestCacheStoragePolicywhich determines how long the results are stored on the device (never, duration of session, permanent).As part of setting up the client, when a URL is set the client creates a new cache with
RKRequestCacheStoragePolicyPermanentlysetting the storage policy involves clearing out the previous session cache and—if caching is disabled—the permanent cache. It’s that clearing that you’re seeing in the logging messages.