Hi Ben, Thanks for posting the guide. A few corrections:
On Mon, Jul 13, 2009 at 8:19 PM, Ben Nevile<[email protected]> wrote: > > So I finally decided I needed to figure out how to make it happen. > Here's a recipe for anyone else who wants to be able to access > memcache via remote_api: > > 1. copy the contents of /google/appengine/ext/remote_api/handler.py > into a new local file. i called mine remote_api_handler.py. then > change your app.yaml to point to this new local file. You don't need to copy the code - just create your own module that imports the relevant parts of the handler module. That way, you'll pick up any future code changes and bugfixes. > > 2. add the following import to remote_api_handler.py: > from google.appengine.api.memcache import memcache_service_pb > > 3. in remote_api_handler.py, find the SERVICE_PB_MAP dictionary. add > the following as a new service: > 'memcache': { > 'Get': (memcache_service_pb.MemcacheGetRequest, > memcache_service_pb.MemcacheGetResponse), > 'Delete': (memcache_service_pb.MemcacheDeleteRequest, > memcache_service_pb.MemcacheDeleteResponse), > 'Increment': (memcache_service_pb.MemcacheIncrementRequest, > memcache_service_pb.MemcacheIncrementResponse), > 'FlushAll': (memcache_service_pb.MemcacheFlushRequest, > memcache_service_pb.MemcacheFlushResponse), > 'Stats': (memcache_service_pb.MemcacheStatsRequest, > memcache_service_pb.MemcacheStatsResponse), > 'Set': (memcache_service_pb.MemcacheSetRequest, > memcache_service_pb.MemcacheSetResponse), > } You can do this by copying and/or modifying that dictionary after you've imported it, then subclassing the handler to use the modified dictionary. > > 4. run your tests to make sure you haven't introduced any errors into > your code. deploy onto your server. > > 5. open /google/appengine/ext/remote_api/remote_api_stub.py. In the > ConfigureRemoteDatastore method, add the following two lines at the > end: > stub = RemoteStub(server, path) > apiproxy_stub_map.apiproxy.RegisterStub('memcache', stub) You can also simply add this to your own code, again avoiding the need to modify the SDK or copy its code. > > (feel free to reimplement this in a less hacky way if you like... the > method could be renamed to include datastore and memcache > configuration.) > > 6. launch your remote_api console. enjoy access to memcache! > > > > Hope that helps someone out. > Ben > > > > -- Nick Johnson, App Engine Developer Programs Engineer Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
