API  1.0.0
CPCache Class Reference

A collection-like container with discardable objects. More...

#import <CPCache.h>

+ Inheritance diagram for CPCache:

Instance Methods

(id< CPCacheDelegate > _delegate) - accessors
 
(int) - countLimit
 
(id) - init
 
(CPString- name
 
(id) - objectForKey:
 
(void) - removeAllObjects
 
(void) - removeObjectForKey:
 
(void) - setCountLimit:
 
(void) - setDelegate:
 
(void) - setName:
 
(void) - setObject:forKey:
 
(void) - setObject:forKey:cost:
 
(void) - setTotalCostLimit:
 
(int) - totalCostLimit
 
- Instance Methods inherited from CPObject
(void) - addObserver:forKeyPath:options:context:
 
(void) - applyChange:toKeyPath:
 
(id) - autorelease
 
(id) - awakeAfterUsingCoder:
 
(void) - awakeFromCib
 
(void) - bind:toObject:withKeyPath:options:
 
(Class) - classForCoder
 
(Class) - classForKeyedArchiver
 
(CPString- className
 
(id) - copy
 
(void) - dealloc
 
(CPString- description
 
(CPDictionary- dictionaryWithValuesForKeys:
 
(void) - didChange:valuesAtIndexes:forKey:
 
(void) - didChangeValueForKey:
 
(void) - didChangeValueForKey:withSetMutation:usingObjects:
 
(void) - doesNotRecognizeSelector:
 
(CPArray) - exposedBindings
 
(id) - forwardingTargetForSelector:
 
(void) - forwardInvocation:
 
(unsigned) - hash
 
(BOOL) - implementsSelector:
 
(CPDictionary- infoForBinding:
 
(BOOL) - isEqual:
 
(BOOL) - isKindOfClass:
 
(BOOL) - isMemberOfClass:
 
(BOOL) - isProxy
 
(IMP) - methodForSelector:
 
(CPMethodSignature) - methodSignatureForSelector:
 
(id) - mutableArrayValueForKey:
 
(id) - mutableArrayValueForKeyPath:
 
(id) - mutableCopy
 
(id) - mutableSetValueForKey:
 
(id) - mutableSetValueForKeyPath:
 
(id) - performSelector:
 
(id) - performSelector:withObject:
 
(void) - performSelector:withObject:afterDelay:
 
(void) - performSelector:withObject:afterDelay:inModes:
 
(id) - performSelector:withObject:withObject:
 
(id) - performSelector:withObjects:
 
(void) - release
 
(void) - removeObserver:forKeyPath:
 
(id) - replacementObjectForArchiver:
 
(id) - replacementObjectForCoder:
 
(id) - replacementObjectForKeyedArchiver:
 
(BOOL) - respondsToSelector:
 
(id) - retain
 
(id) - self
 
(void) - setValue:forKey:
 
(void) - setValue:forKeyPath:
 
(void) - setValue:forUndefinedKey:
 
(void) - setValuesForKeysWithDictionary:
 
(CPString- UID
 
(void) - unbind:
 
(Class) - valueClassForBinding:
 
(id) - valueForKey:
 
(id) - valueForKeyPath:
 
(id) - valueForUndefinedKey:
 
(void) - willChange:valuesAtIndexes:forKey:
 
(void) - willChangeValueForKey:
 
(void) - willChangeValueForKey:withSetMutation:usingObjects:
 

Additional Inherited Members

- Class Methods inherited from CPObject
(BOOL) + accessInstanceVariablesDirectly
 
(id) + alloc
 
(id) + allocWithCoder:
 
(BOOL) + automaticallyNotifiesObserversForKey:
 
(void) + cancelPreviousPerformRequestsWithTarget:
 
(void) + cancelPreviousPerformRequestsWithTarget:selector:object:
 
(Class) + class
 
(BOOL) + conformsToProtocol:
 
(void) + exposeBinding:
 
(void) + initialize
 
(IMP) + instanceMethodForSelector:
 
(BOOL) + instancesImplementSelector:
 
(BOOL) + instancesRespondToSelector:
 
(BOOL) + isBindingExclusive:
 
(BOOL) + isSubclassOfClass:
 
(CPSet) + keyPathsForValuesAffectingValueForKey:
 
(void) + load
 
(id) + new
 
(void) + object:performSelector:withObject:afterDelay:inModes:
 
(void) + setVersion:
 
(Class) + superclass
 
(int) + version
 

Detailed Description

A collection-like container with discardable objects.

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSCache_Class/index.html#//apple_ref/occ/instp/NSCache/delegate

A CPCache object is a collection-like container, or cache, that stores key-value pairs, similar to the CPDictionary class. Developers often incorporate caches to temporarily store objects with transient data that are expensive to create.

Reusing these objects can provide performance benefits, because their values do not have to be recalculated. However, the objects are not critical to the application and can be discarded if memory is tight. If discarded, their values will have to be recomputed again when needed.

Definition at line 2 of file CPCache.h.

Method Documentation

◆ accessors()

- (id< CPCacheDelegate > _delegate) accessors (property)  = delegate
implementation

◆ countLimit()

- (int) countLimit
implementation

Synthesized accessor method.

Provided by category CPCache(CPSynthesizedAccessors).

Definition at line 395 of file CPCache.j.

◆ init()

- (id) init
implementation

Initializes the cache with default values

Returns
the initialized cache

Reimplemented from CPObject.

Definition at line 79 of file CPCache.j.

◆ name()

- (CPString) name
implementation

Synthesized accessor method.

Provided by category CPCache(CPSynthesizedAccessors).

Definition at line 379 of file CPCache.j.

◆ objectForKey:()

- (id) objectForKey: (id)  aKey
implementation

Returns the object which correspond to the given key

Parameters
aKeythe key for the object's entry
Returns
the object for the entry

Definition at line 106 of file CPCache.j.

◆ removeAllObjects()

- (void) removeAllObjects
implementation

Removes all the objects from the cache.

Definition at line 162 of file CPCache.j.

◆ removeObjectForKey:()

- (void) removeObjectForKey: (id)  aKey
implementation

Removes the object from the cache for the given key.

Parameters
aKeythe key of the object to be removed

Definition at line 147 of file CPCache.j.

◆ setCountLimit:()

- (void) setCountLimit: (int)  aCountLimit
implementation

Sets the count limit of the cache. Remove objects if not enough place to keep all of them

Parameters
aCountLimitthe new count limit

Provided by category CPCache(CPSynthesizedAccessors).

Definition at line 188 of file CPCache.j.

◆ setDelegate:()

- (void) setDelegate: (id)  aDelegate
implementation

Sets the cache's delegate.

Parameters
aDelegatethe new delegate

Definition at line 209 of file CPCache.j.

◆ setName:()

- (void) setName: (CPString aValue
implementation

Synthesized accessor method.

Provided by category CPCache(CPSynthesizedAccessors).

Definition at line 387 of file CPCache.j.

◆ setObject:forKey:()

- (void) setObject: (id)  anObject
forKey: (id)  aKey 
implementation

Adds an object with default cost into the cache.

Parameters
anObjectthe object to add in the cache
aKeythe object's key

Definition at line 116 of file CPCache.j.

◆ setObject:forKey:cost:()

- (void) setObject: (id)  anObject
forKey: (id)  aKey
cost: (int)  aCost 
implementation

Adds an object with a cost into the cache.

Parameters
anObjectthe object to add in the cache
aKeythe object's key
aCostthe object's cost

Definition at line 127 of file CPCache.j.

◆ setTotalCostLimit:()

- (void) setTotalCostLimit: (int)  aTotalCostLimit
implementation

Sets the total cost limit of the cache. Remove objects if not enough place to keep all of them

Parameters
aTotalCostLimitthe new total cost limit

Provided by category CPCache(CPSynthesizedAccessors).

Definition at line 199 of file CPCache.j.

◆ totalCostLimit()

- (int) totalCostLimit
implementation

Synthesized accessor method.

Provided by category CPCache(CPSynthesizedAccessors).

Definition at line 411 of file CPCache.j.


The documentation for this class was generated from the following files: