Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 402705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:08:58+00:00 2026-05-12T17:08:58+00:00

I have recently implemented Django’s excellent cache framework. However from what I understand Django

  • 0

I have recently implemented Django’s excellent cache framework. However from what I understand Django will not cache a view that is passed parameters in a get request.
I have an Ajax view that is passed get parameters that I would like to cache for X seconds, what would be an easy way to do this?

In psuedo code I currently have a URL:

http://mysites/ajaxthing/?user=foo&items=10

I would like to cache any this url as long as it has the same get parameters.

I’m currently using the cache decorators in my view:

myview(stuff)

myview = cache_page(myview, 60 * 3)

I did read about django’s vary headers but it went a little over my head, and I’m not even sure its the correct solution

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:08:59+00:00Added an answer on May 12, 2026 at 5:08 pm

    Right, vary headers is not the correct solution, it’s used when you want to cache based on client request headers like user-agent etc.

    You’ll need to use low-level API or template fragment caching. It depends on your views really.

    With low-level API it looks something like this:

    from django.core.cache import cache
    
    def get_user(request):
        user_id = request.GET.get("user_id")
        user = cache.get("user_id_%s"%user_id)
        if user is None:
            user = User.objects.get(pk=user_id)
            cache.set("user_id_%s"%user_id, user, 10*60) # 10 minutes
        ...
        ..
        .
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently implemented an Action that toggles the enabled status of a business
I have recently implemented something in a rails application that allows me to read
I have implemented a factory in my project and it was recently suggested that
I have recently implemented an MVC3 website and had to now include data from
the PHP framework I am using (Kohana) recently implemented the HMVC architecture. I have
I have recently developed an Eclipse plugin, however the plugin does not seem to
I have recently implemented a MIDI Beatbox from the code in Head First Java
I recently upgraded my django framework from 1.3 to 1.4. Today I ran some
I have recently had a linux server compromised from bots uploading .php scripts and
I have recently made changes in some code that makes a char name field

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.