mirror of
https://github.com/gnustep/libs-performance.git
synced 2025-02-23 11:51:20 +00:00
optimise when setting nil object in cache
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/performance/trunk@24931 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
99b9ec51a3
commit
c6f292b4c9
2 changed files with 7 additions and 3 deletions
|
@ -160,14 +160,18 @@
|
||||||
- (void) setName: (NSString*)name;
|
- (void) setName: (NSString*)name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets (or replaces)the cached value for the specified key.
|
* Sets (or replaces)the cached value for the specified key.<br />
|
||||||
|
* The value of anObject may be nil to remove any cached object
|
||||||
|
* for aKey.
|
||||||
*/
|
*/
|
||||||
- (void) setObject: (id)anObject forKey: (NSString*)aKey;
|
- (void) setObject: (id)anObject forKey: (NSString*)aKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets (or replaces)the cached value for the specified key, giving
|
* Sets (or replaces)the cached value for the specified key, giving
|
||||||
* the value the specified lifetime (in seconds). A lifetime of zero
|
* the value the specified lifetime (in seconds). A lifetime of zero
|
||||||
* means that the item is not limited by lifetime.
|
* means that the item is not limited by lifetime.<br />
|
||||||
|
* The value of anObject may be nil to remove any cached object
|
||||||
|
* for aKey.
|
||||||
*/
|
*/
|
||||||
- (void) setObject: (id)anObject
|
- (void) setObject: (id)anObject
|
||||||
forKey: (NSString*)aKey
|
forKey: (NSString*)aKey
|
||||||
|
|
|
@ -467,7 +467,7 @@ static void removeItem(GSCacheItem *item, GSCacheItem **first)
|
||||||
NSMapRemove(my->contents, (void*)aKey);
|
NSMapRemove(my->contents, (void*)aKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxSize > 0 || maxObjects > 0)
|
if (addObjects > 0 && (maxSize > 0 || maxObjects > 0))
|
||||||
{
|
{
|
||||||
if (maxSize > 0)
|
if (maxSize > 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue