Skip to content

Conversation

@haifengkao
Copy link

I have moved DiskCache and NSCache to the arguments of the generic class Cache, which is a subclass of HanekeCache.
The users who want to customize DiskCache or NSCache can use HanekeCache with custom implementation (a subclass) of DiskCache and NSCache

}
}

public class HanekeCache<T: DataConvertible, DiskCacheT, MemoryCacheT where T.Result == T, T : DataRepresentable, DiskCacheT: DiskCache, MemoryCacheT: NSCache> {

Choose a reason for hiding this comment

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

Having MemoryCacheT: NSCache as generic constraint means that the memory cache must be a NSCache subclass, while subclassing NSCache might be not the main preference of a developer while building a custom memory caching system. I recommend to protocols DiskCache and MemoryCache to give complete implementation freedom to the developer.

Copy link
Author

Choose a reason for hiding this comment

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

you are correct. but I need someone to ensure that this PR is going to be merged before I spend time on this.

Choose a reason for hiding this comment

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

Seems fair. I'm not the maintainer so I cannot give you this guarantee, but the swift 4 branch was just merged.

@dcharbonnier
Copy link
Contributor

dcharbonnier commented Jan 30, 2018

if we can preserve compatibility I think there is good chances that we merge it
thx @gringoireDM for the review

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