Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Cache problem in ENAPIRequest.m #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

myellen
Copy link

@myellen myellen commented Jun 19, 2014

Changed cache policy for NSUrlRequests. Fixes problem of receiving the same responses for a given request e.g. receiving the same session_id every time you create a dynamic playlist.

Changed cache policy for NSUrlRequests. Fixes problem of receiving the same responses for a given request e.g. receiving the same session_id every time you create a dynamic playlist.
@newyankeecodeshop
Copy link

I'm not sure this is something that should be set all the time. Since there are rate limits in the API, it is beneficial to get cached responses when the data hasn't changed. Is this caused by echo nest not setting a correct Cache-Control response header for requests that involve dynamic playlists? Maybe you could expose this feature as a global flag or per-request flag?

@myellen
Copy link
Author

myellen commented Jun 19, 2014

Good point. The caching would be useful for things like song/search. This is only an issue when using enios on the iPhone. Dynamic playlists work fine using safari on my macbook. I'll implement your idea of a global flag and per-request flag.

@myellen
Copy link
Author

myellen commented Jun 19, 2014

Just committed a version where there is a per-request flag in new constructors

  • (ENAPIRequest *)GETWithEndpoint:(NSString *)endpoint
    andParameters:(NSDictionary *)parameters
    andCompletionBlock:(ENAPIRequestCompletionBlock)completionBlock
    allowCachedData:(BOOL)allowCachedData;

and

  • (ENAPIRequest *)POSTWithEndpoint:(NSString *)endpoint
    andParameters:(NSDictionary *)parameters
    andCompletionBlock:(ENAPIRequestCompletionBlock)completionBlock
    allowCachedData:(BOOL)allowCachedData;

check it out.

@hashier
Copy link

hashier commented Jun 23, 2014

Just a note: I had caching problems as well with "tickets" because it would only get it once from the server and afterwards only always the cached same ticket again, so I never saw any tickets to be finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants