MLFUCache
适用于 iOS 的一个 LFU 缓存框架,使用 Objective-C 实现。它使用最小堆数据结构和哈希表进行实现。
复杂度
- 插入:O(lg n)
- 查找:O(lg n)
使用方法
API
// This function will insert or update an item into the MLFCache instance and increase its frequency
- (void)setValue:(id)value forKey:(NSString *)key;
// This function will increase the frequnce of item
- (id)valueForKey:(NSString *)key;