Skip to content

Commit d734ea8

Browse files
committed
Added a keyExists method to CCCache
1 parent 6fdfe54 commit d734ea8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

cocos2d/CCCache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
- (instancetype)init;
4646

4747
- (void)preload:(id<NSCopying>)key;
48+
- (BOOL)keyExists:(id<NSCopying>)key;
4849

4950
- (id)rawObjectForKey:(id<NSCopying>)key;
5051
- (id)objectForKey:(id<NSCopying>)key;

cocos2d/CCCache.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ - (void)makeAlias:(id<NSCopying>)alias forKey:(id<NSCopying>)key
115115
[_cacheList setObject:entry forKey:alias];
116116
}
117117

118+
- (BOOL)keyExists:(id<NSCopying>)key
119+
{
120+
return([_cacheList objectForKey:key] != nil);
121+
}
122+
118123
//------------------------------------------------------------------------------
119124

120125
- (void)flush

0 commit comments

Comments
 (0)