key = '%s:%s' % (model, kwargs)
result = cache.get(key)
if result is None:
    result = model.objects.get(**kwargs)
cache.set(key, result, timeout)
return result
Patterns for dealing with memcache Caching in Django