Oh, sorry my fault I had a cache.ram left in a select() sorry... cache.disk seems to work correct :-o
Sorry. On márc. 11, 16:03, mdipierro <mdipie...@cs.depaul.edu> wrote: > very odd. This is the function gluon/cache.py that is supposed to do > the clearing: > > defclear(self, regex=None): > locker = open(self.locker_name,'a') > portalocker.lock(locker, portalocker.LOCK_EX) > storage = shelve.open(self.shelve_name) > if regex == None: > storage.clear() > else: > self._clear(storage, regex) > if not CacheAbstract.cache_stats_name in storage.keys(): > storage[CacheAbstract.cache_stats_name] = { > 'hit_total': 0, > 'misses': 0, > } > storage.sync() > portalocker.unlock(locker) > locker.close() > > On Mar 11, 4:07 am, szimszon <szims...@gmail.com> wrote: > > > > > Hm... After time I see thatcache.disk.clear() isn't working with my > > wsgi setup too :( > > > WSGIDaemonProcess web2py user=www-data group=www-data home=/usr/local/ > > web2py/ processes=5 maximum-requests=10000 > > > Need more testing to allocate the problem :-o > > > On febr. 26, 09:10, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > The fact is the web server may be restarting the process or running > > > more than one process. Apache does the same. In this case you should > > > usecache.disk, notcache.ram. > > > > On Feb 26, 1:34 am, szimszon <szims...@gmail.com> wrote: > > > > > Hello! > > > > > I wonder if somebody could it confirm: > > > > > I have a db: > > > > ------- cut -------- > > > > db.define_table('guestbook', > > > > Field('email','string', > > > > label=T("E-Mail"), > > > > requires=IS_EMAIL()), > > > > Field('nick','string', > > > > label=T("Nickname"), > > > > requires=IS_NOT_EMPTY()), > > > > Field('ts','datetime', > > > > label=T("Date"), > > > > default=request.now, > > > > writable=False, > > > > readable=False), > > > > Field('text','string', > > > > label=T("Text"), > > > > requires=IS_NOT_EMPTY()), > > > > ) > > > > ------- cut -------- > > > > > A controller: > > > > ------- cut -------- > > > > def flush_cache(form=None): > > > > cache.ram.clear() > > > > > def vendegkonyv(): > > > > lista=None > > > > if (( auth.user_id==1 ) and (request.vars.r)): > > > > > form=SQLFORM(db.guestbook,request.vars.r,deletable=True,onaccept=flush_cach > > > > e) > > > > else: > > > > form=SQLFORM(db.guestbook,onaccept=flush_cache) > > > > #form=SQLFORM.factory() > > > > if not auth.user_id: > > > > form[0].append(Recaptcha(request, > > > > "...", > > > > "...")) > > > > if form.accepts(request.vars, session): > > > > response.flash = "Record updated" > > > > flush_cache() > > > > elif form.errors: > > > > response.flash = "Error" > > > > flush_cache() > > > > > try: > > > > lista=db(db.guestbook.id>0).select(orderby=~db.guestbook.ts, > > > > cache=(cache.ram,120)) > > > > except: > > > > pass > > > > return dict(form=form,lista=lista) > > > > ------- cut -------- > > > > > And a view: > > > > ------- cut -------- > > > > {{extend 'layout.html'}} > > > > > <h1>GuestBook</h1> > > > > <div> > > > > {{=form}} > > > > </div> > > > > {{if lista:}} > > > > <table class="vendegkonyv"> > > > > <tr> > > > > <th>{{=db.guestbook.ts.label}}</th> > > > > <th>{{=db.guestbook.nick.label}}</th> > > > > <th>{{=db.guestbook.text.label}}</th> > > > > </tr> > > > > {{for elem in lista:}} > > > > <tr> > > > > <td> > > > > {{if (auth.user_id==1):}} > > > > > {{=A(elem.ts,_href=URL(r=request,f='vendegkonyv',vars=dict(r=elem.id)))}} > > > > {{else:}} > > > > {{=elem.ts}} > > > > {{pass}} > > > > </td> > > > > <td>{{=elem.nick}}</td> > > > > <td>{{=elem.text}}</td> > > > > </tr> > > > > {{pass}} > > > > </table> > > > > ------- cut -------- > > > > > With the cherrypy isn't a problem but with apache2 and wsgi: > > > > > 1, I make 3-4 post to the guest book > > > > 2, delete them > > > > 3, reload the page with a link on page pointing to self to guestbook > > > > > I see 0 to 3-4 post on each click randomly which are nonexistent posts > > > > anymore :( -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.