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

#trivial Fix #226 #246

Merged
merged 3 commits into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/PINCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ - (instancetype)initWithName:(NSString *)name
keyDecoder:keyDecoder
operationQueue:_operationQueue
ttlCache:ttlCache];
_memoryCache = [[PINMemoryCache alloc] initWithName:_name operationQueue:_operationQueue];
_memoryCache = [[PINMemoryCache alloc] initWithName:_name operationQueue:_operationQueue ttlCache:ttlCache];
}
return self;
}
Expand Down
16 changes: 8 additions & 8 deletions Tests/PINCacheTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,8 @@ - (void)testCoreProperties

- (void)testDiskCacheURL
{
// Wait for URL to be created
dispatch_group_t group = dispatch_group_create();
dispatch_group_enter(group);
[self.cache objectForKeyAsync:@"" completion:^(PINCache * _Nonnull cache, NSString * _Nonnull key, id _Nullable object) {
dispatch_group_leave(group);
}];

dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
// Wait for URL to be created. We use enumerateObjectsWithBlock because it waits for a known disk state.
[self.cache.diskCache enumerateObjectsWithBlock:^(NSString * _Nonnull key, NSURL * _Nullable fileURL, BOOL * _Nonnull stop) {}];
BOOL isDir = NO;
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:[self.cache.diskCache.cacheURL path] isDirectory:&isDir];

Expand Down Expand Up @@ -1376,4 +1370,10 @@ - (void)testCustomEncoderDecoder {

}

- (void)testTTLCacheIsSet {
PINCache *cache = [[PINCache alloc] initWithName:@"test" rootPath:PINDiskCachePrefix serializer:nil deserializer:nil keyEncoder:nil keyDecoder:nil ttlCache:YES];
XCTAssert(cache.diskCache.isTTLCache);
XCTAssert(cache.memoryCache.isTTLCache);
}

@end