diff --git a/authserv/server.py b/authserv/server.py
index f5eb74d6aeea965722f75e22c17d0d51e2e4b81c..30efe4fde4000a7395c34f9761cb074120658386 100644
--- a/authserv/server.py
+++ b/authserv/server.py
@@ -64,9 +64,14 @@ def create_app(userdb=None, mc=None):
     app.userdb = userdb
 
     if not mc:
-        import memcache
-        mc = memcache.Client(
-            app.config['MEMCACHE_ADDR'], debug=0)
+        try:
+            import pylibmc
+            mc = pylibmc.Client(
+                app.config['MEMCACHE_ADDR'], binary=True)
+        except ImportError:
+            import memcache
+            mc = memcache.Client(
+                app.config['MEMCACHE_ADDR'], debug=0)
     app.memcache = mc
 
     return app