MBThreadsafeCache(ForSubclassEyesOnly) Category Reference
Declared in | MBThreadsafeCache+Subclassing.h |
---|
Overview
The class extensions in this header file are intended for internal use only by
MBThreadsafeCache
implementations.
Code external to MBThreadsafeCache
should never call these methods directly.
Acquiring the memory cache
– internalCache
Returns the internal NSMutableDictionary
where in-memory cached objects are
stored.
- (nonnull NSMutableDictionary *)internalCache
Discussion
Note: The cache is locked when this method is called by the
MBThreadsafeCache
superclass implementation; subclasses that call
this method directly or perform mutations on the returned
dictionary must only do so when the cache is locked.
Declared In
MBThreadsafeCache+Subclassing.h
Accessing cached items
– internalIsKeyInCache:
Called internally to determine whether a given key has a corresponding value in the cache.
- (BOOL)internalIsKeyInCache:(nonnull id)key
Parameters
key |
The key. |
---|
Return Value
YES
if there is a value for the given key in the cache; NO
otherwise.
Discussion
Note: The cache is locked when this method is called by the
MBThreadsafeCache
superclass implementation; subclasses that call
this method directly must only do so when the cache is locked.
Declared In
MBThreadsafeCache+Subclassing.h
– internalObjectForKey:
Called internally to retrieve a cached object value given its key.
- (nullable id)internalObjectForKey:(nonnull id)key
Parameters
key |
The key whose associated value is to be retrieved. |
---|
Return Value
The value associated with key
. May be nil
.
Discussion
Note: The cache is locked when this method is called by the
MBThreadsafeCache
superclass implementation; subclasses that call
this method directly must only do so when the cache is locked.
Declared In
MBThreadsafeCache+Subclassing.h
Modifying the cache
– internalSetObject:forKey:
Called internally to set a cached object value and associates it with the given key.
- (void)internalSetObject:(nonnull id)obj forKey:(nonnull id)key
Parameters
obj |
The new cached value. |
---|---|
key |
The key whose associated value is to be set. |
Discussion
Note: The cache is locked when this method is called by the
MBThreadsafeCache
superclass implementation; subclasses that call
this method directly must only do so when the cache is locked.
Declared In
MBThreadsafeCache+Subclassing.h
– internalRemoveObjectForKey:
Called internally to remove from the cache the object associated with the given key.
- (void)internalRemoveObjectForKey:(nonnull id)key
Parameters
key |
The key whose associated value is to be removed. |
---|
Discussion
Note: The cache is locked when this method is called by the
MBThreadsafeCache
superclass implementation; subclasses that call
this method directly must only do so when the cache is locked.
Declared In
MBThreadsafeCache+Subclassing.h
– internalClearMemoryCache
Called internally to empty the in-memory object cache.
- (void)internalClearMemoryCache
Discussion
Depending on how the cache instance was initialized, this method may be called automatically in response to memory warnings.
Note: The cache is locked when this method is called by the
MBThreadsafeCache
superclass implementation; subclasses that call
this method directly must only do so when the cache is locked.
Declared In
MBThreadsafeCache+Subclassing.h