Monotone-Parent: defafb3d42bb34384a710aa31d323d75bb693172
Monotone-Revision: 9cbd91b1acc90a99245d977eebc9cfaa5013f540 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-11-16T15:02:14 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
e420fd76e9
commit
95c6872a41
|
@ -1,3 +1,9 @@
|
|||
2009-11-16 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoCache.m: "cache", "users" and "localCache"
|
||||
are now regular ivars. "sharedCache" is now located within the
|
||||
"sharedCache" constructor. "killCache" is now an instance method.
|
||||
|
||||
2009-11-10 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* UI/Scheduler/UIxComponentEditor.m (-_handleAttendeesEdition):
|
||||
|
|
|
@ -424,9 +424,7 @@ static BOOL debugObjectAllocation = NO;
|
|||
if (debugLeaks)
|
||||
{
|
||||
if (debugOn)
|
||||
{
|
||||
NSLog (@"allocated classes:\n%s", GSDebugAllocationList (YES));
|
||||
}
|
||||
NSLog (@"allocated classes:\n%s", GSDebugAllocationList (YES));
|
||||
else
|
||||
{
|
||||
debugOn = YES;
|
||||
|
@ -435,7 +433,7 @@ static BOOL debugObjectAllocation = NO;
|
|||
}
|
||||
|
||||
resp = [super dispatchRequest: _request];
|
||||
[SOGoCache killCache];
|
||||
[cache killCache];
|
||||
|
||||
if (debugRequests)
|
||||
{
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
|
||||
@interface SOGoCache : NSObject
|
||||
{
|
||||
NSMutableDictionary *localCache;
|
||||
NSMutableDictionary *cache;
|
||||
NSMutableDictionary *users;
|
||||
@private
|
||||
memcached_server_st *servers;
|
||||
memcached_st *handle;
|
||||
|
@ -45,7 +48,8 @@
|
|||
|
||||
+ (NSTimeInterval) cleanupInterval;
|
||||
+ (SOGoCache *) sharedCache;
|
||||
+ (void) killCache;
|
||||
|
||||
- (void) killCache;
|
||||
|
||||
- (void) registerObject: (id) object
|
||||
withName: (NSString *) name
|
||||
|
|
|
@ -54,32 +54,20 @@
|
|||
// high to avoid useless database calls.
|
||||
static NSTimeInterval cleanupInterval = 300;
|
||||
|
||||
static NSMutableDictionary *cache = nil;
|
||||
static NSMutableDictionary *users = nil;
|
||||
|
||||
// localCache is used to avoid going all the time to the memcached server during
|
||||
// each request. We'll cache the value we got from memcached for the duration
|
||||
// of the current request - which is good enough for pretty much all caces. We
|
||||
// surely don't want to get new defaults/settings during the _same_ requests, it
|
||||
// could produce relatively strange behaviors
|
||||
static NSMutableDictionary *localCache = nil;
|
||||
|
||||
static NSString *memcachedServerName = @"localhost";
|
||||
|
||||
static SOGoCache *sharedCache = nil;
|
||||
|
||||
#if defined(THREADSAFE)
|
||||
static NSLock *lock;
|
||||
#endif
|
||||
|
||||
@implementation SOGoCache
|
||||
|
||||
#if defined(THREADSAFE)
|
||||
+ (void) initialize
|
||||
{
|
||||
#if defined(THREADSAFE)
|
||||
lock = [NSLock new];
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
+ (NSTimeInterval) cleanupInterval
|
||||
{
|
||||
|
@ -88,6 +76,8 @@ static NSLock *lock;
|
|||
|
||||
+ (SOGoCache *) sharedCache
|
||||
{
|
||||
static SOGoCache *sharedCache = nil;
|
||||
|
||||
#if defined(THREADSAFE)
|
||||
[lock lock];
|
||||
#endif
|
||||
|
@ -100,7 +90,7 @@ static NSLock *lock;
|
|||
return sharedCache;
|
||||
}
|
||||
|
||||
+ (void) killCache
|
||||
- (void) killCache
|
||||
{
|
||||
#if defined(THREADSAFE)
|
||||
[lock lock];
|
||||
|
@ -125,6 +115,12 @@ static NSLock *lock;
|
|||
|
||||
cache = [[NSMutableDictionary alloc] init];
|
||||
users = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// localCache is used to avoid going all the time to the memcached server during
|
||||
// each request. We'll cache the value we got from memcached for the duration
|
||||
// of the current request - which is good enough for pretty much all caces. We
|
||||
// surely don't want to get new defaults/settings during the _same_ requests, it
|
||||
// could produce relatively strange behaviors
|
||||
localCache = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// We fire our timer that will cleanup cache entries
|
||||
|
|
Loading…
Reference in New Issue