I would like to keep some application configuration entries as entities in the datastore. Now, when I update these entries from the Datastore Viewer (development environment) or Google Cloud Platform Datastore user interface (production environment), the new values aren't seen by the application. This is because ndb caches the entities.
My (quite open) question is: what is your technique for keeping configuration entries in the datastore, updating them from Google's user interface, and also providing fresh values to the application?
I have thought of the following:
Set a reasonable
_memcache_timeouton thendb.Modelsubclass which defines the configuration entries - but memcache usage is suboptimal in this case (unnecessary datastore reads are performed).Keep cache settings at maximum, but implement a
flushoperation in the admin area of the application to flush entities individually. This is tricky because you can't be sure of the actual cache key of the entity. But normally it should be_memcache_prefix + key.urlsafe(), where_memcache_prefixis defined in ndb.context module.Update all configuration entries from the admin area of the application, and don't use Google's datastore user interfaces - this requires extra effort.