[CalendarServer-changes] [2444] CalendarServer/branches/unified-cache/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Thu May 22 17:07:17 PDT 2008
Revision: 2444
http://trac.macosforge.org/projects/calendarserver/changeset/2444
Author: dreid at apple.com
Date: 2008-05-22 17:07:16 -0700 (Thu, 22 May 2008)
Log Message:
-----------
Connect and actually serve things from the daemon, this doesn't have tests or handle disconnects yet.
Modified Paths:
--------------
CalendarServer/branches/unified-cache/twistedcaldav/cache.py
CalendarServer/branches/unified-cache/twistedcaldav/root.py
Modified: CalendarServer/branches/unified-cache/twistedcaldav/cache.py
===================================================================
--- CalendarServer/branches/unified-cache/twistedcaldav/cache.py 2008-05-22 23:41:39 UTC (rev 2443)
+++ CalendarServer/branches/unified-cache/twistedcaldav/cache.py 2008-05-23 00:07:16 UTC (rev 2444)
@@ -25,6 +25,7 @@
from twisted.python.filepath import FilePath
from twisted.internet.defer import succeed, fail
+from twisted.internet.protocol import ClientCreator
from twisted.web2.iweb import IResource
from twisted.web2.dav import davxml
@@ -37,6 +38,7 @@
from twisted.internet.threads import deferToThread
from twistedcaldav.log import LoggingMixIn
+from twistedcaldav.memcache import MemCacheProtocol
class CacheTokensProperty(davxml.WebDAVTextElement):
@@ -66,6 +68,8 @@
"""
A base class which provides some common operations
"""
+ propertyStoreFactory = xattrPropertyStore
+
def _principalURI(self, principal):
return str(principal.children[0])
@@ -150,7 +154,6 @@
"""
CACHE_SIZE = 1000
- propertyStoreFactory = xattrPropertyStore
def __init__(self, docroot, cacheSize=None):
self._docroot = docroot
@@ -294,7 +297,7 @@
class MemcacheResponseCache(BaseResponseCache):
- def __init__(self, docroot, host, port, reactor):
+ def __init__(self, docroot, host, port, reactor=None):
self._docroot = docroot
self._host = host
self._port = port
@@ -310,6 +313,16 @@
if self._memcacheProtocol is not None:
return succeed(self._memcacheProtocol)
+ d = ClientCreator(self._reactor, MemCacheProtocol).connectTCP(
+ self._host,
+ self._port)
+
+ def _cacheProtocol(proto):
+ self._memcacheProtocol = proto
+ return proto
+
+ return d.addCallback(_cacheProtocol)
+
def getResponseForRequest(self, request):
def _checkTokens(curTokens, expectedTokens, (code, headers, body)):
if curTokens != expectedTokens:
Modified: CalendarServer/branches/unified-cache/twistedcaldav/root.py
===================================================================
--- CalendarServer/branches/unified-cache/twistedcaldav/root.py 2008-05-22 23:41:39 UTC (rev 2443)
+++ CalendarServer/branches/unified-cache/twistedcaldav/root.py 2008-05-23 00:07:16 UTC (rev 2444)
@@ -25,7 +25,7 @@
from twistedcaldav.extensions import DAVFile
from twistedcaldav.config import config
-from twistedcaldav.cache import ResponseCache, _CachedResponseResource
+from twistedcaldav.cache import ResponseCache, _CachedResponseResource, MemcacheResponseCache
from twistedcaldav.log import Logger
log = Logger()
@@ -55,7 +55,7 @@
if config.Memcached['ClientEnabled']:
self.responseCache = MemcacheResponseCache(
self.fp,
- config.Memcached['BindAddresses'],
+ config.Memcached['BindAddress'],
config.Memcached['Port'])
else:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080522/b87ff43e/attachment.htm
More information about the calendarserver-changes
mailing list