Created
April 29, 2014 18:09
-
-
Save sjaensch/11407830 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webapp2 | |
from google.appengine.api import memcache | |
class MainHandler(webapp2.RequestHandler): | |
def get(self): | |
user_count = memcache.get('user_count') | |
if user_count is None: | |
user_count = 0 | |
else: | |
self.response.write('Got user count {} from memcache.<br>'.format(user_count)) | |
if not memcache.set('user_count', user_count + 1): | |
self.response.write('Could not set memcache value!<br>') | |
self.response.write('Hello world! You are visitor no. {}'.format(user_count + 1)) | |
app = webapp2.WSGIApplication([ | |
('/', MainHandler) | |
], debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment