- Inherits From:
- NSObject
- Declared In:
- EDLRUCache.h
This datastructure does not implement the copying and coding protocols as caches are usually required in the context of algorithms, rather than data storage.
unsigned int size;
NSMutableDictionary *entries;
NSMutableDictionary *timestamps;
size All instance variables are private. entries timestamps
Creating cachesAdding/removing objects
- - initWithCacheSize:
- - addObject:withKey:
- - objectWithKey:
- (void)addObject:(id)newObject withKey:(id)newKey
Adds an entry to the receiver, consisting of newKey and its corresponding value object newObject. For details on the operation please see the discussion in NSDictionary.
- (id)initWithCacheSize:(unsigned int)count
Initialises a newly allocated LRU cache to store count items.
- (id)objectWithKey:(id)aKey
Returns an entry's value given its key, or nil
if no value is associated with aKey.