see the demo in this page:http://code.google.com/intl/en/appengine/
docs/python/runtime.html#App_Caching
### mymodule.py
counter = 0
def increment():
global counter
counter += 1
return counter
### myhandler.py
import mymodule
print "Content-Type: text/plain"
print ""
print "My number: " + str(mymodule.increment())
do you mean if the site has not accessed for some minutes, counter
will be reset to 0?
On 2月12日, 下午4时24分, Tim Hoffman <[email protected]> wrote:
> App caching could last as little as a few minutes if your site is not
> used.
> In addition if multiple instances are run then only one instance will
> have the counter with the correct value.
>
> You should store your obj in the datastore and cache it in memcache.
>
> module level caching is really only useful for cacheable things for
> each instance,
> for example compiled templates.
>
> T
>
> On Feb 12, 3:34 pm, saintthor <[email protected]> wrote:
>
> > ### mymodule.py
> > counter = LargeObj()
>
> > ### myhandler.py
> > import mymodule
>
> > print "Content-Type: text/plain"
> > print ""
> > print "My number: " + str(mymodule.counter)
>
> > if sizeof counter is greater than 1M, can it work?
>
> > if there is no request for days, will counter still be cached?
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.