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

不能缓存没有参数的API请求吗? #32

Open
gaojinhsu opened this issue Apr 15, 2020 · 1 comment
Open

不能缓存没有参数的API请求吗? #32

gaojinhsu opened this issue Apr 15, 2020 · 1 comment

Comments

@gaojinhsu
Copy link

- (void)saveMemoryCacheWithResponse:(CTURLResponse *)response serviceIdentifier:(NSString *)serviceIdentifier methodName:(NSString *)methodName cacheTime:(NSTimeInterval)cacheTime { if (response.originRequestParams && response.content && serviceIdentifier && methodName) { [self.memoryCacheCenter saveCacheWithResponse:response key:[self keyWithServiceIdentifier:serviceIdentifier methodName:methodName requestParams:response.originRequestParams] cacheTime:cacheTime]; } }
请求没有参数时,originRequestParams为空就没办法缓存了。处于什么考虑呢?

@casatwy
Copy link
Owner

casatwy commented Apr 15, 2020

这个主要是我当时的业务场景导致做了这样的决定,因为我们当时业务上那些没有参数的API都是不应该缓存的,它每次访问可能数据都不一样。

你可以按照你的业务场景来做调整。

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

No branches or pull requests

2 participants