英文:
what app types / situations would you use memcache or datastore for websessions on a go app engine web app?
问题
我正在研究使用Golang构建一个Web应用程序,部署到Google App Engine上,但我不确定是使用memcache存储还是来自sessions包的datastore。有没有一个经验法则来确定何时使用每种类型的存储?我了解主要的优缺点,datastore的数据始终存在,但访问速度较慢,而memcache的数据访问速度更快,但可能不总是存在。那么是否有任何情况或应用类型会使用其中一种类型的会话存储?
英文:
I'm looking into building a web app in golang to deploy to google app engine, but I'm not sure whether to use the memcache store or the datastore from this sessions package. Is there a rule of thumb as to when to use each type of store? I understand the main pros and cons, the datastore data will always be there but is much slower to access and the memcache data is much faster to access but may not always be there. So are there any situations or types of application that would use one type of session store from the other?
答案1
得分: 3
同时使用两者。检查内存缓存(memcache)。如果存在会话,则继续。如果不存在,则检查数据存储(datastore)。
这正是Java运行时实现会话的方式,通常也是使用内存缓存的方式。
英文:
Use both. Check memcache. If a session is present, proceed. If not, check the datastore.
This is exactly how sessions are implemented in the Java runtime, and this is generally the way to use memcache.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论