diff --git a/relation.module b/relation.module
index 5972ad1..4d50c28 100644
--- a/relation.module
+++ b/relation.module
@@ -722,7 +722,8 @@ function relation_save($relation) {
     return FALSE;
   }
   $transaction = db_transaction();
-  $relation->arity = count($relation->endpoints[LANGUAGE_NONE]);
+  $endpoints = field_get_items('relation', $relation, 'endpoints');
+  $relation->arity = count($endpoints);
   // use time() instead of REQUEST_TIME, because otherwise tests
   // RelationQuery::order() are impossible.
   $relation->changed = time();
@@ -744,6 +745,10 @@ function relation_save($relation) {
   module_invoke_all('entity_' . $op, $relation, 'relation');
   module_invoke('rules', 'invoke_event', 'relation_' . $op, $relation);
   drupal_static_reset('relation_get_related_entity');
+  foreach ($endpoints as $endpoint) {
+    cache_clear_all('relation:' . $endpoint['entity_type'] . ':' .  $endpoint['entity_id'], 'cache', TRUE);
+  }
+
   return $relation->rid;
 }
 
@@ -877,6 +882,9 @@ function relation_get_related_entity($entity_type, $entity_id, $relation_type =
   if (isset($items[$cache_key])) {
     $entities = $items[$cache_key];
   }
+  else if ($cached = cache_get('relation:' . $cache_key)) {
+    $entities = $items[$cache_key];
+  }
   else {
     $query = relation_query($entity_type, $entity_id, $r_index);
     if ($relation_type) {
@@ -891,6 +899,7 @@ function relation_get_related_entity($entity_type, $entity_id, $relation_type =
     else {
       $entities = FALSE;
     }
+    cache_set('relation:' . $cache_key, $entities);
     $items[$cache_key] = $entities;
   }
 
