I'm working on Appengine with Golang.
I have about 1000 entities on datastore.
When I query all entities(q.GetAll(...)
), Datstore Read Operations
or Datastore Small Operations
run about 2% usage(1k of 50k). It's same when I use KeysOnly()
or Project(..something...)
.
I have read some articles to solve this, I have to store Datastore Query to memcache. But I cannot find how to do that.
So how can I store/retrieve Datastore Query to/from memcache in Go AppEngine?
Or is there other way to decrease datastore read/small operation usage?
I need your help. Thank you.
The best practice is to make a query with KeysOnly()
and caching each call datastore.Get()
for the key.
The algorithm is as follows:
How to use memcache described in the documentation.
Queries are not cached. If your entity are small, you can reduce use a projection query and reduce to small costs. Check out the end of the article for information about generating the necessary search index.