mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-05 16:35:10 +00:00
Monotone-Parent: defafb3d42bb34384a710aa31d323d75bb693172
Monotone-Revision: 9cbd91b1acc90a99245d977eebc9cfaa5013f540 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-11-16T15:02:14 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
+11
-15
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user