Is it possible to share cache between two differente web2py applications?

91 views
Skip to first unread message

Lisandro

unread,
Jan 23, 2017, 3:29:22 PM1/23/17
to web2py-users
I'm using RedisCache, and I've seen that web2py adds a prefix to all the keys I store in the cache.
For example, if I have an application called "master" and I do this:

config = cache.redis('config', lambda: initialize_config(), time_expire=9999999)

... then the actual key used to store the data is "w2p:master:config"

But, what about if I have two applications that need to share the config?
How can I tell web2py to use the same cache prefix for two specific applications?

Lisandro

unread,
Nov 14, 2018, 11:02:07 AM11/14/18
to web2py-users
I've created a pull request to achieve this:

If it's not accepted (which is totally ok with me), I would like to know if I have some other alternative.
Thanks!

Massimo Di Pierro

unread,
Nov 18, 2018, 2:06:37 PM11/18/18
to web2py-users
approved! :-)

Lisandro

unread,
Nov 26, 2018, 9:49:36 AM11/26/18
to web2py-users
Thanks Massimo!
I've recently noted that the fix I did was incomplete.

I've sent a new pull request with the new code:

Regards,
Lisandro.

Massimo Di Pierro

unread,
Dec 7, 2018, 2:57:19 AM12/7/18
to web2py-users
thanks
Reply all
Reply to author
Forward
0 new messages