diff --git a/lib/SAML2/HTTPArtifact.php b/lib/SAML2/HTTPArtifact.php
index 958d61b00d8bbe9a1039bf2a31504df3746b4de1..21646ff6469a2349aa15d0076048db47a630951d 100644
--- a/lib/SAML2/HTTPArtifact.php
+++ b/lib/SAML2/HTTPArtifact.php
@@ -20,11 +20,18 @@ class SAML2_HTTPArtifact extends SAML2_Binding {
 	 */
 	public function getRedirectURL(SAML2_Message $message) {
 
+		$store = SimpleSAML_Store::getInstance();
+		if ($store === FALSE) {
+			throw new Exception('Unable to send artifact without a datastore configured.');
+		}
+
 		$generatedId = pack('H*', ((string)  SimpleSAML_Utilities::stringToHex(SimpleSAML_Utilities::generateRandomBytes(20))));
 		$artifact = base64_encode("\x00\x04\x00\x00" . sha1($message->getIssuer(), TRUE) . $generatedId) ;
 		$artifactData = $message->toUnsignedXML();
 		$artifactDataString = $artifactData->ownerDocument->saveXML($artifactData);
-		SimpleSAML_Memcache::set('artifact:' . $artifact, $artifactDataString);
+
+		$store->set('artifact', $artifact, $artifactDataString, time() + 15*60);
+
 		$params = array(
 			'SAMLart' => $artifact,
 		);
diff --git a/www/saml2/idp/ArtifactResolutionService.php b/www/saml2/idp/ArtifactResolutionService.php
index b1f10d8c66e7adbd3f25baeb8d79fd7b3abeabfc..d1bdf7cd01390f56cf453a9ebe7f2a37606cab42 100644
--- a/www/saml2/idp/ArtifactResolutionService.php
+++ b/www/saml2/idp/ArtifactResolutionService.php
@@ -24,13 +24,18 @@ if (!$idpMetadata->getBoolean('saml20.sendartifact', FALSE)) {
 	throw new SimpleSAML_Error_Error('NOACCESS');
 }
 
+$store = SimpleSAML_Store::getInstance();
+if ($store === FALSE) {
+	throw new Exception('Unable to send artifact without a datastore configured.');
+}
+
 $binding = new SAML2_SOAP();
 $request = $binding->receive();
 if (!($request instanceof SAML2_ArtifactResolve)) {
 	throw new Exception('Message received on ArtifactResolutionService wasn\'t a ArtifactResolve request.');
 }
 $artifact = $request->getArtifact();
-$responseData = SimpleSAML_Memcache::get('artifact:' . $artifact);
+$responseData = $store->get('artifact', $artifact);
 $document = new DOMDocument();
 $document->loadXML($responseData);
 $responseXML = $document->firstChild;