#include <OOCache.h>
Definition at line 57 of file OOCache.h.
◆ autoPrune
◆ dealloc
Definition at line 152 of file OOCache.m.
198{
201
202 [super dealloc];
203}
static void CacheFree(OOCacheImpl *cache)
#define CHECK_INTEGRITY(context)
struct OOCacheImpl * cache
◆ description
| - (NSString *) description |
|
|
|
|
implementation |
Definition at line 152 of file OOCache.m.
207{
208 return [NSString stringWithFormat:@"<%@ %p>{\"%@\", %u elements, prune threshold=%u, auto-prune=%s dirty=%s}", [self class], self, [self name], CacheGetCount(cache), pruneThreshold, autoPrune ? "yes" : "no", dirty ? "yes" : "no"];
209}
◆ dirty
◆ init
Definition at line 152 of file OOCache.m.
213{
214 return [self initWithPList:nil];
215}
◆ initWithPList:
| - (id) initWithPList: |
|
(id) |
pList |
|
Definition at line 152 of file OOCache.m.
218 :(id)pList
219{
220 BOOL OK = YES;
221
222 self = [super init];
224
225 if (OK)
226 {
228 if (
cache == NULL) OK = NO;
229 }
230
232 {
233 if (OK) OK = [pList isKindOfClass:[NSArray class]];
234 if (OK) [self loadFromArray:pList];
235 }
236 if (OK)
237 {
240 }
241
242 if (!OK)
243 {
244 [self release];
246 }
247
248 return self;
249}
@ kOOCacheDefaultPruneThreshold
static OOCacheImpl * CacheAllocate(void)
◆ loadFromArray:
| - (void) loadFromArray: |
|
(NSArray *) |
inArray |
|
|
implementation |
Provided by category OOCache(Private).
Definition at line 152 of file OOCache.m.
391 :(NSArray *)array
392{
393 NSDictionary *entry =
nil;
396
397 if (array ==
nil)
return;
398
399 foreach (entry, array)
400 {
401 if ([entry isKindOfClass:[NSDictionary class]])
402 {
403 key = [entry objectForKey:kSerializedEntryKeyKey];
404 value = [entry objectForKey:kSerializedEntryKeyValue];
405 if ([key isKindOfClass:[NSString class]] && value !=
nil)
406 {
407 [self setObject:value forKey:key];
408 }
409 }
410 }
411}
◆ markClean
◆ name
Definition at line 152 of file OOCache.m.
370{
372}
static NSString * CacheGetName(OOCacheImpl *cache)
◆ objectForKey:
| - (id) objectForKey: |
|
(id) |
key |
|
Definition at line 152 of file OOCache.m.
260 :(id)key
261{
263
265
267
268
270
271 return [[result retain] autorelease];
272}
static id CacheRetrieve(OOCacheImpl *cache, id key)
◆ objectsByAge
| - (NSArray *) objectsByAge |
|
|
|
Definition at line 152 of file OOCache.m.
382{
384}
static NSArray * CacheArrayOfContentsByAge(OOCacheImpl *cache)
◆ pListRepresentation
| - (id) pListRepresentation |
|
|
|
Definition at line 152 of file OOCache.m.
253{
255
257}
static NSArray * CacheArrayOfNodesByAge(OOCacheImpl *cache)
◆ prune
Definition at line 152 of file OOCache.m.
334{
335 unsigned pruneCount;
336 unsigned desiredCount;
338
339
342
344
345 pruneCount =
count - desiredCount;
346
347 NSString *logKey = [NSString stringWithFormat:@"dataCache.prune.%@", CacheGetName(cache)];
350
352
354}
static unsigned CacheGetCount(OOCacheImpl *cache)
static BOOL CacheRemoveOldest(OOCacheImpl *cache, NSString *logKey)
#define OOLogOutdentIf(class)
#define OOLog(class, format,...)
#define OOLogIndentIf(class)
◆ pruneThreshold
| - (unsigned) pruneThreshold |
|
|
|
◆ removeObjectForKey:
| - (void) removeObjectForKey: |
|
(id) |
key |
|
Definition at line 152 of file OOCache.m.
289 :(id)key
290{
292
294
296}
static BOOL CacheRemove(OOCacheImpl *cache, id key)
◆ setAutoPrune:
| - (void) setAutoPrune: |
|
(BOOL) |
flag |
|
Definition at line 152 of file OOCache.m.
316 :(BOOL)flag
317{
318 BOOL
prune = (flag != NO);
320 {
322 [self prune];
323 }
324}
◆ setName:
| - (void) setName: |
|
(NSString *) |
name |
|
Definition at line 152 of file OOCache.m.
376{
378}
static void CacheSetName(OOCacheImpl *cache, NSString *name)
◆ setObject:forKey:
| - (void) setObject: |
|
(id) |
value |
| forKey: |
|
(id) |
key |
|
|
| |
Definition at line 152 of file OOCache.m.
275 :inObject forKey:(id)key
276{
278
280 {
283 }
284
286}
static BOOL CacheInsert(OOCacheImpl *cache, id key, id value)
◆ setPruneThreshold:
| - (void) setPruneThreshold: |
|
(unsigned) |
threshold |
|
Definition at line 152 of file OOCache.m.
299 :(unsigned)threshold
300{
303 {
306 }
307}
@ kOOCacheMinimumPruneThreshold
◆ autoPrune
◆ cache
◆ dirty
◆ pruneThreshold
| - (unsigned) pruneThreshold |
|
private |
The documentation for this class was generated from the following files: