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

Cannot initialize with a TTL memory cache #226

Closed
wiseoldduck opened this issue Jun 13, 2018 · 2 comments
Closed

Cannot initialize with a TTL memory cache #226

wiseoldduck opened this issue Jun 13, 2018 · 2 comments
Labels

Comments

@wiseoldduck
Copy link
Contributor

- (instancetype)initWithName:(nonnull NSString *)name rootPath:(nonnull NSString *)rootPath serializer:(nullable PINDiskCacheSerializerBlock)serializer deserializer:(nullable PINDiskCacheDeserializerBlock)deserializer keyEncoder:(nullable PINDiskCacheKeyEncoderBlock)keyEncoder keyDecoder:(nullable PINDiskCacheKeyDecoderBlock)keyDecoder ttlCache:(BOOL)ttlCache NS_DESIGNATED_INITIALIZER;

passing ttlCache:YES here only enables ttlCache for the disk cache, the memory cache is still set up as a non-ttl cache.

This can be corrected after the fact with PINMemoryCache: - (void)setTtlCache:(BOOL)ttlCache DEPRECATED_MSG_ATTRIBUTE("ttlCache is no longer a settable property and must now be set via initializer."); but, this is unintuitive, and as you can see this method is marked as deprecated.

@internalG
Copy link

Yes, it also happens in sharedCache. The TTL support in latest code is confusing.

@ZengSir ZengSir mentioned this issue May 5, 2019
@mc7h
Copy link

mc7h commented May 13, 2019

Agreed, it's confusing - I ran into issues once I adopted it - my previous custom cache started deleting the disk cache upon instantiation of the Manager. I think because I hadn't adopted the optional Protocol.

Also, shouldn't there be away to turn on TTL for the shared cache of the default Manager? otherwise it's impossible to get ageLimit working.

garrettmoon added a commit that referenced this issue Jun 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants