次のようにビューをキャッシュしたいと思います。
@cache_page(10)
def myview:
    return HttpResponse('content')
これにより、ビューが 10 秒間自動的にキャッシュされ、Cache-Control/Expire ヘッダーも自動的に設定されます。ビューを 10 秒間だけキャッシュしたいのですが、最大経過時間は 3600 秒です。
たとえば、このように試してみました:
@cache_page(10)
def myview:
    response = HttpResponse('content')
    patch_response_headers(response, 3600)
or this way:
@cache_page(10)
def myview:
    response = HttpResponse('content')
    response['Cache-Control'] = 'max-age=3600'
But when specifying one of those within my Django-View it caches the view for 3600 seconds and not 10 seconds. Also tried decorators like 'cache_control' but nothing helps.
Is there a solution for this problem? I'm using Django 1.4.1.
Don't know if it is relavent, my activated middleware classes are
- django.middleware.common.CommonMiddleware
 - django.contrib.sessions.middleware.SessionMiddleware
 - django.middleware.csrf.CsrfViewMiddleware
 - django.contrib.auth.middleware.AuthenticationMiddleware
 - django.contrib.messages.middleware.MessageMiddleware
 - django.middleware.http.ConditionalGetMiddleware
 
I've activated the ConditionalGetMiddleware to make sure a 304 will be sent depending on the last-modified header.
Thanks a lot!
Holger