Presumably use memcache.

On Jul 2, 12:09 pm, Hongyu Li <hongyu...@gmail.com> wrote:
> Thanks for your comment.
> What was you do when want add a global memory cache in your app with django?
>
> On Wed, Jul 1, 2009 at 8:08 PM, Graham Dumpleton <graham.dumple...@gmail.com
>
>
>
>
>
> > wrote:
>
> > On Jul 1, 7:22 pm, Hongyu Li <hongyu...@gmail.com> wrote:
> > > #!/usr/bin/env python
> > > # -*- coding: utf-8     -*-
> > > import xmlrpclib
> > > import os
> > > import sys
> > > import time
> > > import math
> > > import optparse
> > > import tm.filecheck
> > > import service
> > > from django.http import HttpResponse
> > > from django.core.cache import cache
>
> > > def getCategoryAndDetail(request):
> > >         keyword = request.GET.__getitem__('keyword' )
> > >         result1 = keyword + str(cache.has_key('SC_MAPPER'))
> > >         if not (cache.has_key('SC_MAPPER')):
> > >                 cache.set('SC_MAPPER','SC',99999)
> > >         else:
> > >                 sc = cache.get('SC_MAPPER')
> > >         result2 = keyword + str(cache.has_key('SC_MAPPER'))
> > >         return HttpResponse(result1 + result2)
> > > before is my testing code.
> > > When I call this mothod by http, it should retrun false when I first
> > visit,
> > > and return true all the other time, but it is not return true all time
> > after
> > > I first visit. any one meeting the same problem?  this code is work well
> > in
> > > local django development server.
>
> > Could it be because Apache is a multi process server on UNIX systems?
>
> > If this is changing per process state, then it will not affect other
> > concurrently running processes, so if subsequent requests go to a
> > different process, you will not see what you expect.
>
> > Graham
>
> []
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to