Search code examples
javagoogle-app-enginegoogle-cloud-datastoreflagsstatic-variables

How to use a static flag in GAE Datastore?


I would like to have a boolean flag in GAE Datastore to allow or disallow a function to run. In my understanding, If we use a datastore property as the flag, we need to pay for each and every read operation.

It happens like this,

if(flag == true){
//Do 
}else{
//Don't
}

Could you please advise how to use a "flag" efficiently. Is it possible to use a static variable in the program itself other than saving it to the datastore?

Please advise.

Thanks, Karthick


Solution

  • Memcache is your friend. Or take a look at Objectify, which will handle caching for you.