Skip to content

Commit 7dc9b30

Browse files
authored
Set some sane limits on the disk cache for people who forget. (#201)
* Set some sane limits on the disk cache for people who forget. * Add CHANGELOG entry * let's go with 50 instead
1 parent b855621 commit 7dc9b30

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## master
22

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

56
## 3.0.1 -- Beta 5
67
- [fix] Respect small byteLimit settings by checking object size in setObject: [#198](https://github.com/pinterest/PINCache/pull/198)

Source/PINDiskCache.m

+5-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,11 @@ - (instancetype)initWithName:(NSString *)name
150150
_didRemoveAllObjectsBlock = nil;
151151

152152
_byteCount = 0;
153-
_byteLimit = 0;
154-
_ageLimit = 0.0;
153+
154+
// 50 MB by default
155+
_byteLimit = 50 * 1024 * 1024;
156+
// 30 days by default
157+
_ageLimit = 60 * 60 * 24 * 30;
155158

156159
#if TARGET_OS_IPHONE
157160
_writingProtectionOption = NSDataWritingFileProtectionNone;

0 commit comments

Comments
 (0)