mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-11 06:25:31 +00:00
Monotone-Parent: f7b521881c5e35a41842e2cbe3f286dba5a0ea52
Monotone-Revision: a02d7acbde3aa1019073525f5b106dac9819e84e Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-02-18T19:14:37 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2010-02-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoCache.m: worked around in bug in GCC
|
||||
occurring with libmemcached >= 0.37 by making the servers and
|
||||
handle ivars static globals.
|
||||
|
||||
2010-02-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/WebServerResources/SchedulerUI.js
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
NSMutableDictionary *users;
|
||||
float cleanupInterval;
|
||||
NSString *memcachedServerName;
|
||||
@private
|
||||
memcached_server_st *servers;
|
||||
memcached_st *handle;
|
||||
// @private
|
||||
// memcached_server_st *servers;
|
||||
// memcached_st *handle;
|
||||
}
|
||||
|
||||
+ (SOGoCache *) sharedCache;
|
||||
|
||||
+38
-21
@@ -47,6 +47,18 @@
|
||||
|
||||
#import "SOGoCache.h"
|
||||
|
||||
/* Those used to be ivars but were converted to static globals to work around
|
||||
a bug in GCC that prevent SOGo from using libmemcached > 0.37:
|
||||
|
||||
"SOGoCache.m:409: internal compiler error: in encode_gnu_bitfield, at
|
||||
objc/objc-act.c:8218
|
||||
Please submit a full bug report,
|
||||
with preprocessed source if appropriate.
|
||||
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions." */
|
||||
|
||||
static memcached_server_st *servers = NULL;
|
||||
static memcached_st *handle = NULL;
|
||||
|
||||
@implementation SOGoCache
|
||||
|
||||
+ (SOGoCache *) sharedCache
|
||||
@@ -88,30 +100,34 @@
|
||||
// relatively strange behaviors
|
||||
localCache = [NSMutableDictionary new];
|
||||
|
||||
handle = memcached_create(NULL);
|
||||
if (handle)
|
||||
{
|
||||
if (!handle)
|
||||
{
|
||||
handle = memcached_create(NULL);
|
||||
if (handle)
|
||||
{
|
||||
#warning We could also make the port number configurable and even make use \
|
||||
of NGNetUtilities for that.
|
||||
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
// We define the default value for cleaning up cached users'
|
||||
// preferences. This value should be relatively high to avoid
|
||||
// useless database calls.
|
||||
sd = [SOGoSystemDefaults sharedSystemDefaults];
|
||||
// We define the default value for cleaning up cached users'
|
||||
// preferences. This value should be relatively high to avoid
|
||||
// useless database calls.
|
||||
|
||||
cleanupInterval = [sd cacheCleanupInterval];
|
||||
ASSIGN (memcachedServerName, [sd memcachedHost]);
|
||||
cleanupInterval = [sd cacheCleanupInterval];
|
||||
ASSIGN (memcachedServerName, [sd memcachedHost]);
|
||||
|
||||
[self logWithFormat: @"Cache cleanup interval set every %f seconds",
|
||||
cleanupInterval];
|
||||
[self logWithFormat: @"Using host '%@' as server",
|
||||
memcachedServerName];
|
||||
servers
|
||||
= memcached_server_list_append(NULL,
|
||||
[memcachedServerName UTF8String],
|
||||
11211, &error);
|
||||
error = memcached_server_push(handle, servers);
|
||||
}
|
||||
[self logWithFormat: @"Cache cleanup interval set every %f seconds",
|
||||
cleanupInterval];
|
||||
[self logWithFormat: @"Using host '%@' as server",
|
||||
memcachedServerName];
|
||||
if (!servers)
|
||||
servers
|
||||
= memcached_server_list_append(NULL,
|
||||
[memcachedServerName UTF8String],
|
||||
11211, &error);
|
||||
error = memcached_server_push(handle, servers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -119,8 +135,9 @@
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
memcached_server_free (servers);
|
||||
memcached_free (handle);
|
||||
/* Commented out because of a bug in GCC:
|
||||
memcached_server_free (servers);
|
||||
memcached_free (handle); */
|
||||
[memcachedServerName release];
|
||||
[cache release];
|
||||
[users release];
|
||||
|
||||
Reference in New Issue
Block a user