Commit Graph
7 Commits
Author SHA1 Message Date
erbalito 1779cf1a64 resolves #1729
A fix to avoid an error when time_expire=0 and set the proper cache_control instead.
2019-02-24 21:37:03 -03:00
erbalito df2d09706c resolves #2098 2019-02-21 08:39:41 -03:00
erbalito 118e57dd15 Update redis_cache.py
Small fix to make proper use of current.request.application when application is not provided
2019-02-21 08:12:07 -03:00
erbalito 178f48799a Merge branch 'master' into master 2018-11-26 11:46:59 -03:00
erbalito 109206e721 Merge pull request #1 from erbalito/erbalito-patch-1
fixes #2058
2018-11-26 11:43:38 -03:00
erbalito 9d8fce0687 fixes #2058
I've modified redis_cache.py to be able to optionally provide an application name to RedisCache constructor. This makes possible to share cache between different web2py applications if needed.
2018-11-21 09:40:19 -03:00
erbalito 66f6549817 Update redis_cache.py to allow sharing cache between different applications
I'm not sure if this would help someone else. I've always had this scenario where some of my web2py applications share the models, and therefore, need to share the cache (I use Redis). In the past I've asked if there was any possibility to share cache between applications, but I got no answers:
https://groups.google.com/forum/#!searchin/web2py/share$20cache$20application%7Csort:date/web2py/iNCzMq8ADnw/ufyPBWajBQAJ

Anyway, I've noticed that I could make a simple change to redis_cache.py to achieve what I was looking for: I've added the optional argument "application" to RedisCache(). If you inspect the RedisCache() code, you will notice that previously it was forced to use current.request.application for the instance_name. With this simple change I did, it's possible to provide an application name to the RedisCache() constructor.

This has worked like a charm for my specific scenario, and I think I can say that it has backwards compatibility. Still, if this proposal isn't accepted, I would like to hear about some alternative to share cache between applications. Thanks!
2018-11-14 12:47:04 -03:00