adium 2234:98bf3a79f9dd: Delete prefs cache clearing the rest of...

commits at adium.im commits at adium.im
Mon May 18 00:29:30 UTC 2009


details:	http://hg.adium.im/adium/rev/98bf3a79f9dd
revision:	2234:98bf3a79f9dd
author:		David Smith <catfish.man at gmail.com>
date:		Sun May 17 17:28:49 2009 -0700

Delete prefs cache clearing the rest of the way

diffstat:

 Source/AIPreferenceContainer.h |   5 +-
 Source/AIPreferenceContainer.m |  59 +----------------------------
 2 files changed, 4 insertions(+), 60 deletions(-)

diffs (132 lines):

diff -r 74eaf999acbe -r 98bf3a79f9dd Source/AIPreferenceContainer.h
--- a/Source/AIPreferenceContainer.h	Sun May 17 19:10:00 2009 -0400
+++ b/Source/AIPreferenceContainer.h	Sun May 17 17:28:49 2009 -0700
@@ -15,11 +15,10 @@
 	NSMutableDictionary	*prefsWithDefaults;
 
 	NSMutableDictionary	*defaults;
-	NSTimer				*timer_clearingOfCache;
-	NSInteger					preferenceChangeDelays;
+	NSInteger			preferenceChangeDelays;
 	
 	NSMutableDictionary **myGlobalPrefs;
-	NSInteger					*myUsersOfGlobalPrefs;
+	NSInteger			*myUsersOfGlobalPrefs;
 	NSTimer				**myTimerForSavingGlobalPrefs;
 	NSString			*globalPrefsName;
 }
diff -r 74eaf999acbe -r 98bf3a79f9dd Source/AIPreferenceContainer.m
--- a/Source/AIPreferenceContainer.m	Sun May 17 19:10:00 2009 -0400
+++ b/Source/AIPreferenceContainer.m	Sun May 17 17:28:49 2009 -0700
@@ -16,7 +16,6 @@
 
 @interface AIPreferenceContainer ()
 - (id)initForGroup:(NSString *)inGroup object:(AIListObject *)inObject;
-- (void)emptyCache:(NSTimer *)inTimer;
 - (void)save;
 @property (readonly, nonatomic) NSMutableDictionary *prefs;
 - (void) loadGlobalPrefs;
@@ -25,7 +24,6 @@
 - (void) setPrefValue:(id)val forKey:(id)key;
 @end
 
-#define EMPTY_CACHE_DELAY		120.0
 #define	SAVE_OBJECT_PREFS_DELAY	10.0
 
 /* XXX Remove me */
@@ -34,11 +32,11 @@
 #endif
 
 static NSMutableDictionary	*objectPrefs = nil;
-static NSInteger					usersOfObjectPrefs = 0;
+static NSInteger			usersOfObjectPrefs = 0;
 static NSTimer				*timer_savingOfObjectCache = nil;
 
 static NSMutableDictionary	*accountPrefs = nil;
-static NSInteger					usersOfAccountPrefs = 0;
+static NSInteger			usersOfAccountPrefs = 0;
 static NSTimer				*timer_savingOfAccountCache = nil;
 	
 /*!
@@ -120,10 +118,7 @@
 	[defaults release]; defaults = nil;
 	[group release];
 	[object release];
-	[timer_clearingOfCache release]; timer_clearingOfCache = nil;
 	[globalPrefsName release]; globalPrefsName = nil;
-
-	[self emptyCache:nil];
 	
 	[super dealloc];
 }
@@ -133,52 +128,6 @@
 	return NO;
 }
 
-#pragma mark Cache
-
-/*!
- * @brief Empty our cache
- */
-- (void)emptyCache:(NSTimer *)inTimer
-{
-	AILogWithSignature(@"Would be clearing the prefs cache, but that's disabled for debugging");
-	return;
-	
-	if (object) {
-		(*myUsersOfGlobalPrefs)--;
-		
-		[prefs release]; prefs = nil;
-		[prefsWithDefaults release]; prefsWithDefaults = nil;
-		
-		if ((*myUsersOfGlobalPrefs) == 0) {
-			[*myGlobalPrefs release]; *myGlobalPrefs = nil;
-		}
-
-	} else {
-		[prefs release]; prefs = nil;
-		[prefsWithDefaults release]; prefsWithDefaults = nil;
-	}
-	
-	[timer_clearingOfCache release]; timer_clearingOfCache = nil;
-}
-
-/*!
- * @brief Queue clearing of the cache
- *
- * If this method isn't called again within 30 seconds, the passed key will be removed from the passed cache dictionary.
- */
-- (void)queueClearingOfCache
-{
-	if (!timer_clearingOfCache) {
-		timer_clearingOfCache = [[NSTimer scheduledTimerWithTimeInterval:EMPTY_CACHE_DELAY
-																  target:self
-																selector:@selector(emptyCache:)
-																userInfo:nil
-																 repeats:NO] retain];
-	} else {
-		[timer_clearingOfCache setFireDate:[NSDate dateWithTimeIntervalSinceNow:EMPTY_CACHE_DELAY]];
-	}
-}
-
 #pragma mark Defaults
 
 @synthesize defaults;
@@ -295,8 +244,6 @@
 												  withName:group
 													create:YES] retain];
 		}
-		
-		[self queueClearingOfCache];
 	}
 	
 	return prefs;
@@ -318,8 +265,6 @@
 		} else {
 			prefsWithDefaults = [self.prefs retain];
 		}
-		
-		[self queueClearingOfCache];
 	}
 
 	return prefsWithDefaults;




More information about the commits mailing list