From 4b37534ec34be02c913817449b4a46c94bef7b14 Mon Sep 17 00:00:00 2001 From: Jens Ayton Date: Mon, 13 Aug 2018 12:10:23 +0200 Subject: [PATCH] Remove deprecated interfaces --- Sources/SPTPersistentCacheOptions.m | 46 ------------ Tests/SPTPersistentCacheOptionsTests.m | 74 ------------------- .../SPTPersistentCacheOptions.h | 44 ----------- 3 files changed, 164 deletions(-) diff --git a/Sources/SPTPersistentCacheOptions.m b/Sources/SPTPersistentCacheOptions.m index af68f2a..9aa413d 100644 --- a/Sources/SPTPersistentCacheOptions.m +++ b/Sources/SPTPersistentCacheOptions.m @@ -156,52 +156,6 @@ - (NSString *)debugDescription @end -@implementation SPTPersistentCacheOptions (Deprectated) - -- (instancetype)initWithCachePath:(NSString *)cachePath - identifier:(NSString *)cacheIdentifier - defaultExpirationInterval:(NSUInteger)defaultExpirationInterval - garbageCollectorInterval:(NSUInteger)garbageCollectorInterval - debug:(nullable SPTPersistentCacheDebugCallback)debugCallback -{ - self = [self init]; - - if (self) { - _cachePath = [cachePath copy]; - _cacheIdentifier = [cacheIdentifier copy]; - - _defaultExpirationPeriod = SPTGuardedPropertyValue(defaultExpirationInterval, SPTPersistentCacheMinimumExpirationLimit, @selector(defaultExpirationPeriod), debugCallback); - _garbageCollectionInterval = SPTGuardedPropertyValue(garbageCollectorInterval, SPTPersistentCacheMinimumGCIntervalLimit, @selector(garbageCollectionInterval), debugCallback); - - _debugOutput = [debugCallback copy]; - } - - return self; -} - -- (BOOL)folderSeparationEnabled -{ - return self.useDirectorySeparation; -} - -- (void)setFolderSeparationEnabled:(BOOL)folderSeparationEnabled -{ - self.useDirectorySeparation = folderSeparationEnabled; -} - -- (NSUInteger)gcIntervalSec -{ - return self.garbageCollectionInterval; -} - -- (NSUInteger)defaultExpirationPeriodSec -{ - return self.defaultExpirationPeriod; -} - -@end - - static NSUInteger SPTGuardedPropertyValue(NSUInteger proposedValue, NSUInteger minimumValue, SEL propertySelector, SPTPersistentCacheDebugCallback debugCallback) { if (proposedValue >= minimumValue) { diff --git a/Tests/SPTPersistentCacheOptionsTests.m b/Tests/SPTPersistentCacheOptionsTests.m index 8f251db..08806c6 100644 --- a/Tests/SPTPersistentCacheOptionsTests.m +++ b/Tests/SPTPersistentCacheOptionsTests.m @@ -48,21 +48,6 @@ - (void)testDefaultInitializer XCTAssertNotNil(self.dataCacheOptions.identifierForQueue, @"The identifier for queue shouldn't be nil"); } -- (void)testMinimumGarbageCollectorIntervalForDeprecatedInit -{ - _Pragma("clang diagnostic push"); - _Pragma("clang diagnostic ignored \"-Wdeprecated\""); - SPTPersistentCacheOptions *dataCacheOptions = [[SPTPersistentCacheOptions alloc] initWithCachePath:[NSTemporaryDirectory() stringByAppendingPathComponent:SPTPersistentCacheOptionsPathComponent] - identifier:@"test" - defaultExpirationInterval:1 - garbageCollectorInterval:1 - debug:nil]; - _Pragma("clang diagnostic pop"); - - XCTAssertEqual(dataCacheOptions.garbageCollectionInterval, - SPTPersistentCacheMinimumGCIntervalLimit); -} - - (void)testMinimumGarbageCollectorInterval { __weak XCTestExpectation *expectation = [self expectationWithDescription:@"debugOuput is executed"]; @@ -82,21 +67,6 @@ - (void)testMinimumGarbageCollectorInterval SPTPersistentCacheMinimumGCIntervalLimit); } -- (void)testMinimumDefaultExpirationIntervalForDeprecatedInit -{ - _Pragma("clang diagnostic push"); - _Pragma("clang diagnostic ignored \"-Wdeprecated\""); - SPTPersistentCacheOptions *dataCacheOptions = [[SPTPersistentCacheOptions alloc] initWithCachePath:[NSTemporaryDirectory() stringByAppendingPathComponent:SPTPersistentCacheOptionsPathComponent] - identifier:@"test" - defaultExpirationInterval:1 - garbageCollectorInterval:1 - debug:nil]; - _Pragma("clang diagnostic pop"); - - XCTAssertEqual(dataCacheOptions.defaultExpirationPeriod, - SPTPersistentCacheMinimumExpirationLimit); -} - - (void)testMinimumDefaultExpiration { __weak XCTestExpectation *expectation = [self expectationWithDescription:@"debugOuput is executed"]; @@ -150,50 +120,6 @@ - (void)testCopying XCTAssertEqual(original.sizeConstraintBytes, copy.sizeConstraintBytes, @"The values of the property \"sizeConstraintBytes\" should be equal"); } -#pragma mark Compatibility Properties for Deprecated Properties - -- (void)testFolderSeparationEnabled -{ - _Pragma("clang diagnostic push"); - _Pragma("clang diagnostic ignored \"-Wdeprecated\""); - - SPTPersistentCacheOptions * const options = [SPTPersistentCacheOptions new]; - - XCTAssertEqual(options.folderSeparationEnabled, options.useDirectorySeparation); - - options.folderSeparationEnabled = NO; - XCTAssertFalse(options.useDirectorySeparation, @"Setting the compatibility property should update the real property"); - XCTAssertEqual(options.folderSeparationEnabled, options.useDirectorySeparation); - - _Pragma("clang diagnostic pop"); -} - -- (void)testGcIntervalSec -{ - _Pragma("clang diagnostic push"); - _Pragma("clang diagnostic ignored \"-Wdeprecated\""); - - SPTPersistentCacheOptions * const options = [SPTPersistentCacheOptions new]; - options.garbageCollectionInterval = SPTPersistentCacheDefaultGCIntervalSec + 37; - - XCTAssertEqual(options.gcIntervalSec, options.garbageCollectionInterval); - - _Pragma("clang diagnostic pop"); -} - -- (void)testDefaultExpirationPeriodSec -{ - _Pragma("clang diagnostic push"); - _Pragma("clang diagnostic ignored \"-Wdeprecated\""); - - SPTPersistentCacheOptions * const options = [SPTPersistentCacheOptions new]; - options.defaultExpirationPeriod = SPTPersistentCacheDefaultExpirationTimeSec + 37; - - XCTAssertEqual(options.defaultExpirationPeriodSec, options.defaultExpirationPeriod); - - _Pragma("clang diagnostic pop"); -} - #pragma mark Describing objects - (void)testDescriptionAdheresToStyle diff --git a/include/SPTPersistentCache/SPTPersistentCacheOptions.h b/include/SPTPersistentCache/SPTPersistentCacheOptions.h index eb138b6..a38f17d 100644 --- a/include/SPTPersistentCache/SPTPersistentCacheOptions.h +++ b/include/SPTPersistentCache/SPTPersistentCacheOptions.h @@ -203,48 +203,4 @@ FOUNDATION_EXPORT const NSUInteger SPTPersistentCacheMinimumExpirationLimit; @end - -#pragma mark - Deprecation Category - -/** - * Methods on `SPTPersistentCacheOptions` that are deprecated and will be removed in a later release. - */ -@interface SPTPersistentCacheOptions (Deprectated) - -/** - * Returns a new instance of the class setup with specific values. - * @deprecated - * @param cachePath Path in the system file for the cache. - * @param cacheIdentifier An identifier for the cache. - * @param defaultExpirationInterval Default time which have to pass since last file access so file could be candidate - * for pruning on next GC. - * @param garbageCollectorInterval It is guaranteed that once started GC runs with this interval. - * @param debugCallback A callback used for debugging purposes. May be nil. - */ -- (instancetype)initWithCachePath:(NSString *)cachePath - identifier:(NSString *)cacheIdentifier - defaultExpirationInterval:(NSUInteger)defaultExpirationInterval - garbageCollectorInterval:(NSUInteger)garbageCollectorInterval - debug:(nullable SPTPersistentCacheDebugCallback)debugCallback DEPRECATED_MSG_ATTRIBUTE("Configure the option instance’s properties instead."); - -/** - * Compatibility alias for `useDirectorySeparation`. - * @seealso useDirectorySeparation - */ -@property (nonatomic, assign) BOOL folderSeparationEnabled DEPRECATED_MSG_ATTRIBUTE("Use the useDirectorySeparation property instead"); -/** - * Compatibility alias for `garbageCollectionInterval`. - * @deprecated - * @seealso garbageCollectionInterval - */ -@property (nonatomic, assign, readonly) NSUInteger gcIntervalSec DEPRECATED_MSG_ATTRIBUTE("Use the garbageCollectionInterval property instead"); -/** - * Compatibility alias for `defaultExpirationPeriod`. - * @deprecated - * @seealso defaultExpirationPeriod - */ -@property (nonatomic, assign, readonly) NSUInteger defaultExpirationPeriodSec DEPRECATED_MSG_ATTRIBUTE("Use the defaultExpirationPeriod property instead"); - -@end - NS_ASSUME_NONNULL_END