diff --git a/GSCache.h b/GSCache.h
index 20bd0da..16197e9 100644
--- a/GSCache.h
+++ b/GSCache.h
@@ -160,14 +160,18 @@
- (void) setName: (NSString*)name;
/**
- * Sets (or replaces)the cached value for the specified key.
+ * Sets (or replaces)the cached value for the specified key.
+ * The value of anObject may be nil to remove any cached object
+ * for aKey.
*/
- (void) setObject: (id)anObject forKey: (NSString*)aKey;
/**
* Sets (or replaces)the cached value for the specified key, giving
* 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.
+ * The value of anObject may be nil to remove any cached object
+ * for aKey.
*/
- (void) setObject: (id)anObject
forKey: (NSString*)aKey
diff --git a/GSCache.m b/GSCache.m
index 5f94423..25d77f2 100644
--- a/GSCache.m
+++ b/GSCache.m
@@ -467,7 +467,7 @@ static void removeItem(GSCacheItem *item, GSCacheItem **first)
NSMapRemove(my->contents, (void*)aKey);
}
- if (maxSize > 0 || maxObjects > 0)
+ if (addObjects > 0 && (maxSize > 0 || maxObjects > 0))
{
if (maxSize > 0)
{