Index: django/db/models/base.py
===================================================================
--- django/db/models/base.py	(revision 6250)
+++ django/db/models/base.py	(working copy)
@@ -15,6 +15,7 @@
 from django.utils.encoding import smart_str, force_unicode, smart_unicode
 from django.conf import settings
 from itertools import izip
+from weakref import WeakValueDictionary
 import types
 import sys
 import os
@@ -77,6 +78,35 @@
         # registered version.
         return get_model(new_class._meta.app_label, name, False)
 
+    def __call__(cls, *args, **kwargs):
+        """
+        this method will either create an instance (by calling the default implementation)
+        or try to retrieve one from the class-wide cache by infering the pk value from 
+        args and kwargs. If instance caching is enabled for this class, the cache is 
+        populated whenever possible (ie when it is possible to infer the pk value). 
+        """
+        def new_instance():
+            return super(ModelBase, cls).__call__(*args, **kwargs)
+        
+        # we always pop those settings from kwargs not to pollute the instance
+        instance_caching_enabled = kwargs.pop('meta__instance_caching', False) or cls.meta__instance_caching
+        # simplest case, just create a new instance every time 
+        if not instance_caching_enabled:
+            return new_instance()
+        
+        instance_key = cls._get_cache_key(args, kwargs)
+        # depending on the arguments, we might not be able to infer the PK, so in that case we create a new instance
+        if instance_key is None:
+            return new_instance()
+
+        cached_instance = cls.get_cached_instance(key)
+        if cached_instance is None:
+            cached_instance = new_instance()
+            # FIXME test cached_instance._get_pk_val() ==  instance_key 
+            cls.cache_instance(cached_instance)
+            
+        return cached_instance
+
 class Model(object):
     __metaclass__ = ModelBase
 
@@ -97,6 +127,50 @@
     def __ne__(self, other):
         return not self.__eq__(other)
 
+    def _get_cache_key(cls, args, kwargs):
+        result = None
+        pk = cls._meta.pk
+        # get the index of the pk in the class fields. this should be calculated *once*, but isn't atm
+        pk_position = cls._meta.fields.index(pk)
+        # if it's in the args, we can get it easily by index
+        if len(args) > pk_position:
+            result = args[pk_position]
+        # retrieve the pk value. Note that we use attname instead of name, to handle the case where the pk is a 
+        # a ForeignKey.
+        elif pk.attname in kwargs:
+            result = kwargs[pk.attname]
+        # ok we couldn't find the value, but maybe it's a FK and we can find the corresponding object instead
+        elif pk.name != pk.attname and pk.name in kwargs:
+            result = kwargs[pk.name]
+        # if the pk value happens to be a model (which can happen wich a FK), we'd rather use its own pk as the key
+        if result is not None and isinstance(result, Model):
+            result = result._get_pk_val()
+        return result
+    _get_cache_key = classmethod(_get_cache_key)
+
+    def get_cached_instance(cls, id):
+        """
+        Method to retrieve a cached instance by pk value. Returns None when not found (which will always be the case when caching is disabled for this class).
+        """
+        return cls.__instance_cache__.get(id)
+    get_cached_instance = classmethod(get_cached_instance)
+
+    def cache_instance(cls, instance):
+        """
+        Method to store an instance in the cache. The instance will only be stored if 'instance.meta__instance_cache' is 'True', which means it is 
+        possible to override the class-wide settings in the instance. 
+        """
+        if instance.meta__instance_cache and instance._get_pk_val() is not None:
+            cls.__instance_cache__[instance._get_pk_val()] = instance
+    cache_instance = classmethod(cache_instance)
+
+    def flush_cached_instance(cls, instance):
+        """
+        Method to flush an instance from the cache. The instance will always be flushed from the cache, since this is most likely called from delete().
+        We do not test the pk value because delete() does it and it will fail silently anyway. 
+        """
+        self.__instance_cache__.pop(_get_pk_val(), None)
+
     def __init__(self, *args, **kwargs):
         dispatcher.send(signal=signals.pre_init, sender=self.__class__, args=args, kwargs=kwargs)
 
@@ -197,6 +271,10 @@
         if hasattr(cls, 'get_absolute_url'):
             cls.get_absolute_url = curry(get_absolute_url, opts, cls.get_absolute_url)
 
+        cls.__instance_cache__ = WeakValueDictionary()
+        # enable the cache according to user preferences (off by default)
+        cls.meta__instance_caching = getattr(cls, 'meta__instance_caching', False)
+
         dispatcher.send(signal=signals.class_prepared, sender=cls)
 
     _prepare = classmethod(_prepare)
@@ -260,6 +338,9 @@
                 setattr(self, self._meta.pk.attname, connection.ops.last_insert_id(cursor, self._meta.db_table, self._meta.pk.column))
         transaction.commit_unless_managed()
 
+        # if we're a new instance that hasn't been written in; save ourself.
+        self.__class__.cache_instance(self)
+
         # Run any post-save hooks.
         dispatcher.send(signal=signals.post_save, sender=self.__class__, instance=self)
 
@@ -319,6 +400,8 @@
         seen_objs = SortedDict()
         self._collect_sub_objects(seen_objs)
 
+        # remove ourself from the cache
+        self.__class__.flush_cached_instance(self)
         # Actually delete the objects
         delete_objects(seen_objs)
 
Index: django/db/models/fields/related.py
===================================================================
--- django/db/models/fields/related.py	(revision 6250)
+++ django/db/models/fields/related.py	(working copy)
@@ -165,12 +165,15 @@
                 if self.field.null:
                     return None
                 raise self.field.rel.to.DoesNotExist
-            other_field = self.field.rel.get_related_field()
-            if other_field.rel:
-                params = {'%s__pk' % self.field.rel.field_name: val}
-            else:
-                params = {'%s__exact' % self.field.rel.field_name: val}
-            rel_obj = self.field.rel.to._default_manager.get(**params)
+            # try to get a cached instance, and if that fails retrieve it from the db 
+            rel_obj = self.field.rel.to.get_cached_instance(val)
+            if rel_obj is None:
+                other_field = self.field.rel.get_related_field()
+                if other_field.rel:
+                    params = {'%s__pk' % self.field.rel.field_name: val}
+                else:
+                    params = {'%s__exact' % self.field.rel.field_name: val}
+                rel_obj = self.field.rel.to._default_manager.get(**params)
             setattr(instance, cache_name, rel_obj)
             return rel_obj
 
Index: django/db/models/query.py
===================================================================
--- django/db/models/query.py	(revision 6250)
+++ django/db/models/query.py	(working copy)
@@ -1134,6 +1134,11 @@
             dispatcher.send(signal=signals.pre_delete, sender=cls, instance=instance)
 
         pk_list = [pk for pk,instance in seen_objs[cls]]
+        # we wipe the cache now; it's *possible* some form of a __get__ lookup may reintroduce an item after
+        # the fact with the same pk (extremely unlikely)
+        for instance in seen_objs.values():
+            cls.flush_cached_instance(instance)
+
         for related in cls._meta.get_all_related_many_to_many_objects():
             if not isinstance(related.field, generic.GenericRelation):
                 for offset in range(0, len(pk_list), GET_ITERATOR_CHUNK_SIZE):
@@ -1167,6 +1172,8 @@
     for cls in ordered_classes:
         seen_objs[cls].reverse()
         pk_list = [pk for pk,instance in seen_objs[cls]]
+        for instance in seen_objs.values():
+            cls.flush_cached_instance(instance)
         for offset in range(0, len(pk_list), GET_ITERATOR_CHUNK_SIZE):
             cursor.execute("DELETE FROM %s WHERE %s IN (%s)" % \
                 (qn(cls._meta.db_table), qn(cls._meta.pk.column),
Index: django/core/serializers/xml_serializer.py
===================================================================
--- django/core/serializers/xml_serializer.py	(revision 6250)
+++ django/core/serializers/xml_serializer.py	(working copy)
@@ -176,7 +176,7 @@
                 else:
                     value = field.to_python(getInnerText(field_node).strip())
                 data[field.name] = value
-
+        data["meta__instance_cache"] = False
         # Return a DeserializedObject so that the m2m data has a place to live.
         return base.DeserializedObject(Model(**data), m2m_data)
 
@@ -234,4 +234,3 @@
         else:
            pass
     return u"".join(inner_text)
-
Index: django/core/serializers/python.py
===================================================================
--- django/core/serializers/python.py	(revision 6250)
+++ django/core/serializers/python.py	(working copy)
@@ -88,7 +88,7 @@
             # Handle all other fields
             else:
                 data[field.name] = field.to_python(field_value)
-
+        data["meta__instance_cache"] = False
         yield base.DeserializedObject(Model(**data), m2m_data)
 
 def _get_model(model_identifier):
Index: tests/modeltests/select_related/models.py
===================================================================
--- tests/modeltests/select_related/models.py	(revision 6250)
+++ tests/modeltests/select_related/models.py	(working copy)
@@ -107,13 +107,13 @@
 1
 
 # select_related() also of course applies to entire lists, not just items.
-# Without select_related()
+# Without select_related() (note instance caching still reduces this from 9 to 5)
 >>> db.reset_queries()
 >>> world = Species.objects.all()
 >>> [o.genus.family for o in world]
 [<Family: Drosophilidae>, <Family: Hominidae>, <Family: Fabaceae>, <Family: Amanitacae>]
 >>> len(db.connection.queries)
-9
+5
 
 # With select_related():
 >>> db.reset_queries()
@@ -129,23 +129,23 @@
 >>> pea.genus.family.order.klass.phylum.kingdom.domain
 <Domain: Eukaryota>
 
-# Notice: one few query than above because of depth=1
+# notice: instance caching saves the day; would be 7 without.
 >>> len(db.connection.queries)
-7
+1
 
 >>> db.reset_queries()
 >>> pea = Species.objects.select_related(depth=5).get(name="sativum")
 >>> pea.genus.family.order.klass.phylum.kingdom.domain
 <Domain: Eukaryota>
 >>> len(db.connection.queries)
-3
+1
 
 >>> db.reset_queries()
 >>> world = Species.objects.all().select_related(depth=2)
 >>> [o.genus.family.order for o in world]
 [<Order: Diptera>, <Order: Primates>, <Order: Fabales>, <Order: Agaricales>]
 >>> len(db.connection.queries)
-5
+1
 
 # Reset DEBUG to where we found it.
 >>> settings.DEBUG = False
