[CalendarServer-changes] [4264] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu May 14 15:15:50 PDT 2009
Revision: 4264
http://trac.macosforge.org/projects/calendarserver/changeset/4264
Author: sagen at apple.com
Date: 2009-05-14 15:15:49 -0700 (Thu, 14 May 2009)
Log Message:
-----------
Adds an expiration time for PROPFIND response cache entries (30 minutes)
Modified Paths:
--------------
CalendarServer/trunk/conf/caldavd-apple.plist
CalendarServer/trunk/conf/caldavd-test.plist
CalendarServer/trunk/conf/caldavd.plist
CalendarServer/trunk/twistedcaldav/cache.py
CalendarServer/trunk/twistedcaldav/config.py
CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
Modified: CalendarServer/trunk/conf/caldavd-apple.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-apple.plist 2009-05-14 21:32:28 UTC (rev 4263)
+++ CalendarServer/trunk/conf/caldavd-apple.plist 2009-05-14 22:15:49 UTC (rev 4264)
@@ -481,6 +481,11 @@
<key>EnableWebAdmin</key>
<true/>
+ <!-- Response Caching -->
+ <key>ResponseCacheTimeout</key>
+ <integer>30</integer> <!-- in minutes -->
+
+
</dict>
</plist>
Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist 2009-05-14 21:32:28 UTC (rev 4263)
+++ CalendarServer/trunk/conf/caldavd-test.plist 2009-05-14 22:15:49 UTC (rev 4264)
@@ -716,5 +716,10 @@
<string>English</string>
</dict>
+ <!-- Response Caching -->
+ <key>ResponseCacheTimeout</key>
+ <integer>30</integer> <!-- in minutes -->
+
+
</dict>
</plist>
Modified: CalendarServer/trunk/conf/caldavd.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd.plist 2009-05-14 21:32:28 UTC (rev 4263)
+++ CalendarServer/trunk/conf/caldavd.plist 2009-05-14 22:15:49 UTC (rev 4264)
@@ -461,6 +461,10 @@
<key>EnableWebAdmin</key>
<true/>
+ <!-- Response Caching -->
+ <key>ResponseCacheTimeout</key>
+ <integer>30</integer> <!-- in minutes -->
+
</dict>
</plist>
Modified: CalendarServer/trunk/twistedcaldav/cache.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/cache.py 2009-05-14 21:32:28 UTC (rev 4263)
+++ CalendarServer/trunk/twistedcaldav/cache.py 2009-05-14 22:15:49 UTC (rev 4264)
@@ -29,6 +29,7 @@
from twistedcaldav.log import LoggingMixIn
from twistedcaldav.memcachepool import CachePoolUserMixIn
+from twistedcaldav.config import config
class DisabledCacheNotifier(object):
@@ -78,7 +79,7 @@
self.log_debug("Changing Cache Token for %r" % (url,))
return self.getCachePool().set(
'cacheToken:%s' % (url,),
- self._newCacheToken())
+ self._newCacheToken(), expireTime=config.ResponseCacheTimeout*60)
class BaseResponseCache(LoggingMixIn):
@@ -282,7 +283,8 @@
responseBody)))
self.log_debug("Adding to cache: %r = %r" % (key, cacheEntry))
- return self.getCachePool().set(key, cacheEntry).addCallback(
+ return self.getCachePool().set(key, cacheEntry,
+ expireTime=config.ResponseCacheTimeout*60).addCallback(
lambda _: response)
def _cacheResponse((key, responseBody)):
Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py 2009-05-14 21:32:28 UTC (rev 4263)
+++ CalendarServer/trunk/twistedcaldav/config.py 2009-05-14 22:15:49 UTC (rev 4264)
@@ -424,6 +424,8 @@
},
"EnableKeepAlive": True,
+
+ "ResponseCacheTimeout": 30, # Minutes
}
class Config (object):
Modified: CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py 2009-05-14 21:32:28 UTC (rev 4263)
+++ CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py 2009-05-14 22:15:49 UTC (rev 4264)
@@ -694,6 +694,12 @@
if record:
self.log_debug("Storing (%s %s) %s in internal cache" % (indexType, origIndexKey, record))
+
+ # Fetch the set of groups this record is a member of so we can
+ # cache it, rather than have each process make the same group
+ # lookup
+ record._groupMembershipGUIDs = self.groupsForGUID(record.guid)
+
self.recordCacheForType(recordType).addRecord(record, indexType, origIndexKey)
def _parseResourceInfo(self, plist, guid, recordType, shortname):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090514/a9a24bac/attachment.html>
More information about the calendarserver-changes
mailing list