login


使用model cache给你的GAE应用程序加速
刚刚看到gae group里面的一片文章,里面实现了一个利用memcache来进行model cache的方法。
使用非常简单,而且加速效果明显:-)在这里分享下:D

原文在这:google group讨论

http://appengine-cookbook.appspot.com/recipe/seamless-memcache-caching-of-all-entities/


使用很简单,在你的models.py 最上方

import datastore_cache
datastore_cache.DatastoreCachingShim.Install()


然后就可以享受memcache带来的急速体验了:-)
他的一些优点和限制:
. All entities will be cached in memcache as they pass through this api proxy. Your get requests will be served out of memcache if there is a hit. The cache is updated through:

- puts
- gets
- queries

Limitations:
- The cache is completely pessimistic in the case of transactions. In case of a request that is part of a transaction:
* gets are not served from the cache
* puts/deletes invalidate those entities from the cache when they commit
* puts/deletes do not change the cache if they rollback
- If your entity keys are larger than the size allowed for memcache keys the cache will fail



    Share in Google Reader     Share in Twitter..     Share in Friendfeed     Leave a Reply

2 Response to “使用model cache给你的GAE应用程序加速”

  1. isfrog Says:

    很纳闷 该怎么进入后台呢?

  2. evertobe Says:

    用你的google 帐号登录后 进/admin/

Leave a Reply


Logo

About Me

  • A Computer Geek in Beijing, China. Focus on Web2.0 Technology: Google App Engine, Python, Django, Software Architecture, Agile, JAVA, J2EE, JavaScript, etc.

    Coding for fun, Coding with passion :-) It's my life!

Most Popular Posts

Tags