Saturday 15 September 2012

rest - Which backend for caching results from API calls in Django -


I have a dynamic project where a user can do a search, and as a result many SAC REST API calls to generate results Are created for. It can take anywhere from 3-10 seconds. I want to implement the cache to improve the performance for APIs and manage the results to quota management. Some important requirements:

  • The results remain longer and may be invalid for every 6-months or more
  • The results are Jason
  • The data of these cached results can be used to add new app features and the Django model can be expanded at a later date

    Looking at the set (last ASP) what do you think best wik The P can be? When searching for the first time, I was also looking for EliPhone to apply the cellar to work.

    As you mention it, the results remain for a long time, so do not save the results on the disk. Once the first time it has a text file containing JSON?

    I had a similar problem with some API calls, which were extracted in large amounts of data.

    • hash query string ( search = noodles => 838f8d9a [..] a370bbfa6df46b171c02f0c )
    • The hash exists in the file ( Search for <838f8d9a [..] a370bbfa6df46b171c02f0c.txt )
      • If the file exists:
        • See the time of the file creation (see)
        • Recently enough, just send the content of the file as a response.
        • If the file does not exist:
          • Generate the content (as you are now doing) and save the contents in a file (future requests
          • Send content in response as a filename
          • < / Ul>

            Although there is some weakness: I'm serving the content through Dengig because I check some user permissions but you can not Content URL can also back!

            This is a simple solution and it is very easy to implement. For your last requirement, you can see the hit on each hash that the most frequent requests are and will continue from there.

            Hope this is helpful and happy coding!

No comments:

Post a Comment