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

Set some sane limits on the disk cache for people who forget. #201

Merged
merged 4 commits into from
Oct 1, 2017
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## master

* Add your own contributions to the next release on the line below this with your name.
- [fix] Add some sane limits to the disk cache: [#201]https://github.com/pinterest/PINCache/pull/201

## 3.0.1 -- Beta 5
- [fix] Respect small byteLimit settings by checking object size in setObject: [#198](https://github.com/pinterest/PINCache/pull/198)
Expand Down
7 changes: 5 additions & 2 deletions Source/PINDiskCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,11 @@ - (instancetype)initWithName:(NSString *)name
_didRemoveAllObjectsBlock = nil;

_byteCount = 0;
_byteLimit = 0;
_ageLimit = 0.0;

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

#if TARGET_OS_IPHONE
_writingProtectionOption = NSDataWritingFileProtectionNone;
Expand Down