Grab Context.{set,get}_session_cache_mode from the sessions branch, plus the unit tests.
diff --git a/OpenSSL/ssl/context.c b/OpenSSL/ssl/context.c
index aa4976d..a92a476 100644
--- a/OpenSSL/ssl/context.c
+++ b/OpenSSL/ssl/context.c
@@ -717,6 +717,38 @@
     }
 }
 
+static char ssl_Context_set_session_cache_mode_doc[] = "\n\
+Enable/disable session caching and the mode used.\n\
+\n\
+@param mode: One or more of the SESS_CACHE_* flags (combine using bitwise or)\n\
+@return: The previously set caching mode.n\
+";
+static PyObject *
+ssl_Context_set_session_cache_mode(ssl_ContextObj *self, PyObject *args)
+{
+    long mode, result;
+
+    if (!PyArg_ParseTuple(args, "l:set_session_cache_mode", &mode))
+        return NULL;
+
+    result = SSL_CTX_set_session_cache_mode(self->ctx, mode);
+    return PyLong_FromLong(result);
+
+}
+
+static char ssl_Context_get_session_cache_mode_doc[] = "\n\
+Returns the currently used cache mode.\n\
+\n\
+@return: The currently used cache mode.\n\
+";
+static PyObject *
+ssl_Context_get_session_cache_mode(ssl_ContextObj *self, PyObject *args)
+{
+    if (!PyArg_ParseTuple(args, ":get_session_cache_mode"))
+        return NULL;
+    return PyLong_FromLong((long)SSL_CTX_get_session_cache_mode(self->ctx));
+}
+
 static char ssl_Context_set_verify_doc[] = "\n\
 Set the verify mode and verify callback\n\
 \n\
@@ -1176,6 +1208,8 @@
     ADD_METHOD(check_privatekey),
     ADD_METHOD(load_client_ca),
     ADD_METHOD(set_session_id),
+    ADD_METHOD(set_session_cache_mode),
+    ADD_METHOD(get_session_cache_mode),
     ADD_METHOD(set_verify),
     ADD_METHOD(set_verify_depth),
     ADD_METHOD(get_verify_mode),
diff --git a/OpenSSL/ssl/ssl.c b/OpenSSL/ssl/ssl.c
index cee3661..a68f447 100644
--- a/OpenSSL/ssl/ssl.c
+++ b/OpenSSL/ssl/ssl.c
@@ -274,6 +274,20 @@
     PyModule_AddIntConstant(module, "SSLEAY_PLATFORM", SSLEAY_PLATFORM);
     PyModule_AddIntConstant(module, "SSLEAY_DIR", SSLEAY_DIR);
 
+    /* Cache modes */
+#define CACHE_MODE(mode) \
+    PyModule_AddIntConstant(module, "SESS_CACHE_" #mode, SSL_SESS_CACHE_##mode)
+
+    CACHE_MODE(OFF);
+    CACHE_MODE(CLIENT);
+    CACHE_MODE(SERVER);
+    CACHE_MODE(BOTH);
+    CACHE_MODE(NO_AUTO_CLEAR);
+    CACHE_MODE(NO_INTERNAL_LOOKUP);
+    CACHE_MODE(NO_INTERNAL_STORE);
+    CACHE_MODE(NO_INTERNAL);
+#undef CACHE_MODE
+
     /* Straight up version number */
     PyModule_AddIntConstant(module, "OPENSSL_VERSION_NUMBER", OPENSSL_VERSION_NUMBER);