clear select() cache on GAE?

13 views
Skip to first unread message

Dan

unread,
Jul 16, 2009, 2:16:48 PM7/16/09
to web2py Web Framework
Hello- I saw this thread which discusses ways to clear a cached select
() result on non-GAE platforms. Is there a way to use the cache.clear
(regex=??) command to remove the results of a known datastore query
that works on GAE too?
Dan

mdipierro

unread,
Jul 16, 2009, 4:54:02 PM7/16/09
to web2py Web Framework
yes

cache.ram.clear(regex="....")

Dan

unread,
Jul 16, 2009, 6:58:25 PM7/16/09
to web2py Web Framework
sorry, I meant to ask: what should I put in the regex? For example, if
this is the select statement that I sent previously, how can I clear
the results of it from the cache?

results = db(auth.settings.table_user.name=="Joe").select(cache=
(self.cache.ram,3600))

mdipierro

unread,
Jul 16, 2009, 7:03:05 PM7/16/09
to web2py Web Framework
correction. This is DOES NOT supported on GAE.

Dan

unread,
Jul 16, 2009, 7:28:48 PM7/16/09
to web2py Web Framework
so would I need to run a new query? is that the only way to remove the
old/invalid results when running on GAE?

mdipierro

unread,
Jul 16, 2009, 9:58:11 PM7/16/09
to web2py Web Framework
On GAE, in this statement

results = db(auth.settings.table_user.name=="Joe").select(cache=
(self.cache.ram,3600))

the cache is not used. The cache statement is ignored so no need to
clear the cache.

Probably this will be fixed in the new DAL.

You can cache the records yourself

results=cache.memcache('myrecords': lambda: db
(auth.settings.table_user.name=="Joe").select(cache=(self.cache.ram,
3600)).as_list(),5000)

and clear it with

cache.memcache.delete('myrecords') ### memcache only syntax

Anyway, I am skeptical you get any speed up out of all this.

Massimo

Dan

unread,
Jul 16, 2009, 10:45:13 PM7/16/09
to web2py Web Framework
Ah, ok. I didn't realize that it was ignored. I'll use the lambda
approach. thanks
Reply all
Reply to author
Forward
0 new messages