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

Support PINMemoryCache cost methods in PINCache #149

Merged
merged 2 commits into from Dec 15, 2016

Conversation

msqr
Copy link
Contributor

@msqr msqr commented Dec 1, 2016

This PR addresses issue #64 to expose methods on PINCache that accept a memory cache cost argument.

@msqr msqr changed the title INCache to support the PINMemoryCache methods that accept a cost argument PINCache to support the PINMemoryCache methods that accept a cost argument Dec 1, 2016
@msqr msqr changed the title PINCache to support the PINMemoryCache methods that accept a cost argument Support PINMemoryCache cost methods in PINCache Dec 1, 2016
@param cost An amount to add to the <memoryCache.totalCost>.
@param block A block to be executed concurrently after the object has been stored, or nil.
*/
- (void)setObject:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost block:(nullable PINCacheObjectBlock)block;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be:
- (void)setObject:(id <NSCoding>)object forKey:(NSString *)key withCost:(NSUInteger)cost block:(nullable PINCacheObjectBlock)block; ? (adding the NSCoding protocol to object)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! This was a copy/paste from PINMemoryCache. I've pushed a correction now.

@param key A key to associate with the object. This string will be copied.
@param cost An amount to add to the <memoryCache.totalCost>.
*/
- (void)setObject:(nullable id)object forKey:(nullable NSString *)key withCost:(NSUInteger)cost;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be:
- (void)setObject:(id <NSCoding>)object forKey:(NSString *)key withCost:(NSUInteger)cost; (id shouldn't be nullable should be conforming to NSCoding and key shouldn't be nullable)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! This was a copy/paste from PINMemoryCache. I've pushed a correction now.

@garrettmoon
Copy link
Collaborator

Thank you for putting this up, much appreciated! Also appreciate new tests :)

…uire NSCoding objects and non-null keys, consistent with rest of API.
@garrettmoon garrettmoon merged commit 373cd45 into pinterest:master Dec 15, 2016
@garrettmoon
Copy link
Collaborator

Awesome, sorry this took so long to merge, really appreciate it!

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.

None yet

2 participants