Reputation: 892
I'm just experimenting with Appstats and NDB on Google App Engine.
I understand that the immediate get following the put would come from the local memory cache but why is there a memcache delete operation?
This is all the code:
import webapp2
from google.appengine.ext import ndb
class Specs(ndb.Model):
make = ndb.StringProperty()
model = ndb.StringProperty()
doors = ndb.IntegerProperty()
wheels = ndb.IntegerProperty()
class Car(ndb.Model):
_use_memcache = True
_use_cache = True
specs = ndb.LocalStructuredProperty(Specs)
class MainHandler(webapp2.RequestHandler):
def get(self):
my_car = Car(id='some-car')
specs = Specs(
make = "Volvo",
model = "240",
doors = 5,
wheels = 4
)
my_car.specs = specs
result = my_car.put()
my_car_by_get = result.get()
self.response.write('Saved car')
app = webapp2.WSGIApplication([
('/', MainHandler),
], debug=True)
And the Appstats timeline:
Upvotes: 3
Views: 226
Reputation: 21835
The memcache.Delete()
is being called on every put()
when you're using the NDB because of the automatic caching and this is by design. You can read more about the NDB caching if you want to have a better control or different behaviour when it comes to caching.
Upvotes: 1