This repository was archived by the owner on Feb 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDFDiskCache.h
More file actions
38 lines (27 loc) · 1.24 KB
/
DFDiskCache.h
File metadata and controls
38 lines (27 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// The MIT License (MIT)
//
// Copyright (c) 2015 Alexander Grebenyuk (github.com/kean).
#import <Foundation/Foundation.h>
#import "DFFileStorage.h"
NS_ASSUME_NONNULL_BEGIN
static const unsigned long long DFDiskCacheCapacityUnlimited = 0;
/*! Disk cache extends file storage functionality by providing LRU (least recently used) cleanup. Cleanup doesn't get called automatically.
*/
@interface DFDiskCache : DFFileStorage
- (instancetype)initWithName:(NSString *)name;
/*! Maximum disk cache capacity. Default value is 100 Mb.
@discussion Not a strict limit. Disk storage is actually cleaned up only when cleanup method gets called.
*/
@property (nonatomic) unsigned long long capacity;
/*! Remaining disk usage after cleanup. The rate must be in the range of 0.0 to 1.0 where 1.0 represents full disk capacity. Default and recommended value is 0.5.
*/
@property (nonatomic) float cleanupRate;
/*! Cleans up disk cache by discarding the least recently used items.
@discussion Cleanup algorithm runs only if max disk cache capacity is set to non-zero value. Target size is calculated by multiplying disk capacity and cleanup rate.
*/
- (void)cleanup;
/*! Returns path to caches directory.
*/
+ (NSString *)cachesDirectoryPath;
@end
NS_ASSUME_NONNULL_END