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 8190489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:39:53+00:00 2026-06-07T03:39:53+00:00

I am writing a web application on google app engine in python using jinja2

  • 0

I am writing a web application on google app engine in python using jinja2 as a templating system and the app basically allows users to write posts/comments and rank other user’s posts. The ranking system is based on the number of up/downvotes and the number of comments. I am trying to use memcache to store this calculated value and rank the posts accordingly.

I only want to store the value in the database occasionally so as to not make the write costs expensive. I am planning on having a counter and storing it in the database every 10 votes/comments. I was thinking something like this:

# I update the counter every time that I add a vote or comment
counter = 0
def posts_cache(update = False):
        global counter
        key = 'main'
        posts = memcache.get(key)
        if posts is None or update:
                logging.error("DB QUERY")
                posts = db.GqlQuery("SELECT * "
                                        "FROM Post "
                                        "ORDER BY rank DESC "
                                        "LIMIT 100",
                                         key)
                posts = list(posts)
                memcache.set(key, posts)
        if counter>=10:
                counter = 0
                #put the memcache posts in the database
        return posts

But I am not sure how to take the posts I have in memcache and store them in the database. Is there any way to do this in python? I’ve looked through the docs but haven’t found a clear way to do it.

  • 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-06-07T03:39:55+00:00Added an answer on June 7, 2026 at 3:39 am
    1. You can’t do it because memcache is not a reliable in the sense it can evict your entities and than you will lost data.
    2. Storing the entities in bulk don’t cost you less, you pay per entity put.
    3. In order to lower your writing cost try setting indexed=false on attributes that don’t you don’t need them indexed.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking at writing a Java web application on Google App Engine. I
I am writing a web application using GWT and App Engine. My application will
I am using Google App Engine to host my Facebook Application because it is
I'm writing application which consists of server side on Google App Engine (Java) and
I'm writing a web application using the google maps api v3, which displays places
I'm writing web application using razor view engine. In Visual Studio I got the
When writing a web application which allows the upload of files, one must be
I'm writing a web application that connects to a database. I'm currently using a
I am writing a web-application using Play 1.2.3 . One of the feature is
I'm writing a web application where users can submit pictures, videos, and descriptons of

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.