diff --git a/uuid.entity.inc b/uuid.entity.inc
index 4fa037f..4ba5424 100644
--- a/uuid.entity.inc
+++ b/uuid.entity.inc
@@ -389,7 +389,7 @@ function entity_uuid_delete($entity_type, $uuid) {
  * Helper function that retrieves entity IDs by their UUIDs.
  *
  * @todo
- *   Statically cache as many IDs as possible and limit the query.
+ *   Limit the query.
  *
  * @param $entity_type
  *   The entity type we should be dealing with.
@@ -406,6 +406,11 @@ function entity_get_id_by_uuid($entity_type, $uuids, $revision = FALSE) {
   if (empty($uuids)) {
     return array();
   }
+  $cached_ids = entity_uuid_id_cache($entity_type, $uuids, $revision);
+  if (count($cached_ids) == count($uuids)) {
+    return $cached_ids;
+  }
+  $uuids = array_diff($uuids, $cached_ids);
   $info = entity_get_info($entity_type);
   // Find out what entity keys to use.
   if (!$revision) {
@@ -424,18 +429,33 @@ function entity_get_id_by_uuid($entity_type, $uuids, $revision = FALSE) {
   }
 
   // Get all UUIDs in one query.
-  return db_select($table, 't')
+  $result = db_select($table, 't')
     ->fields('t', array($uuid_key, $id_key))
     ->condition($uuid_key, array_values($uuids), 'IN')
-    ->execute()
-    ->fetchAllKeyed();
+    ->execute();
+    $result = $result->fetchAllKeyed();
+  $cache = &drupal_static('entity_uuid_id_cache', array());
+  $cache[$entity_type][(int) $revision] += $result;
+  return $result + $cached_ids;
+}
+
+/**
+ * Helper caching function.
+ */
+function entity_uuid_id_cache($entity_type, $ids, $revision) {
+  $cache = &drupal_static(__FUNCTION__, array());
+  if (empty($cache[$entity_type][(int) $revision])) {
+    $cache[$entity_type][(int) $revision] = array();
+  }
+  $cached_ids = $cache[$entity_type][(int) $revision];
+  return array_intersect_key($cached_ids, array_flip($ids));
 }
 
 /**
  * Helper function that retrieves UUIDs by their entity IDs.
  *
  * @todo
- *   Statically cache as many IDs as possible and limit the query.
+ *   Limit the query.
  *
  * @param $entity_type
  *   The entity type we should be dealing with.
@@ -452,6 +472,12 @@ function entity_get_uuid_by_id($entity_type, $ids, $revision = FALSE) {
   if (empty($ids)) {
     return array();
   }
+  $cached_ids = array_flip(entity_uuid_id_cache($entity_type, $ids, $revision));
+  if (count($cached_ids) == count($ids)) {
+    return $cached_ids;
+  }
+  $ids = array_diff($ids, $cached_ids);
+
   $info = entity_get_info($entity_type);
   // Find out what entity keys to use.
   if (!$revision) {
@@ -470,11 +496,14 @@ function entity_get_uuid_by_id($entity_type, $ids, $revision = FALSE) {
   }
 
   // Get all UUIDs in one query.
-  return db_select($table, 't')
+  $result = db_select($table, 't')
     ->fields('t', array($id_key, $uuid_key))
     ->condition($id_key, array_values($ids), 'IN')
     ->execute()
     ->fetchAllKeyed();
+  $cache = &drupal_static('entity_uuid_id_cache', array());
+  $cache[$entity_type][(int) $revision]+= array_flip($result);
+  return $result + $cached_ids;
 }
 
 /**
