Skip to content

Commit

Permalink
Set some sane limits on the disk cache for people who forget. (#201)
Browse files Browse the repository at this point in the history
* Set some sane limits on the disk cache for people who forget.

* Add CHANGELOG entry

* let's go with 50 instead
  • Loading branch information
garrettmoon authored Oct 1, 2017
1 parent b855621 commit 7dc9b30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit 7dc9b30

Please sign in to comment.