pinterest / PINCache

Fast, non-deadlocking parallel object cache for iOS, tvOS and OS X

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discrepancy between Header Comment and Implementation

jlaws opened this issue · comments

commented

PINDiskCache.h line 156 states

/**
 The maximum number of bytes allowed on disk. This value is checked every time an object is set, if the written
 size exceeds the limit a trim call is queued. Defaults to `0.0`, meaning no practical limit.
 
 */
@property (assign) NSUInteger byteLimit;

/**
 The maximum number of seconds an object is allowed to exist in the cache. Setting this to a value
 greater than `0.0` will start a recurring GCD timer with the same period that calls <trimToDate:>.
 Setting it back to `0.0` will stop the timer. Defaults to `0.0`, meaning no limit.
 
 */
@property (assign) NSTimeInterval ageLimit;

It states the byteLimit and ageLimit default to 0. This is not actually the case based on the code in PINDiskCache.m line 215

        // 50 MB by default
        _byteLimit = 50 * 1024 * 1024;
        // 30 days by default
        _ageLimit = 60 * 60 * 24 * 30;

Either the header needs to be updated or the defaults need to change.