Hi,

I have a tags table which will be available to all logged in users. The 
table has the following structure:

db.define_table('META_TAG',
    Field('tag','string',notnull=True),
    Field('root_tag','string',notnull=True),
    Field('active_ind','string',length=1,default='Y')
)

This table will be rarely (once a month) updated via an administrative 
interface.
I read various web2py based examples and gae examples on using memcache. 
Each followed a different approach.
As per my understanding from appengine documentation, I have written the 
following helper function in a controller to use memcache:

*from google.appengine.api import memcache*

def get_tags():
    """This function returns cached value for META_TAG table"""
    tags = memcache.get("tags")
    if not words:
        words = 
db(db.META_TAG.active_ind=='Y').select(db.META_TAG.tag,db.META_TAG.root_tag)
        memcache.add("tags",tags)
        return tags
    else:
        return tags

Will the above code ensure that the correct data is always available in the 
memcache ?

Reply via email to