Awesome! The fix worked like a charm ;)
Thank you very much Niphlod, I really appreciate your help, you're
definitely a wise "web2py guru".
I've been always grateful for the help received here. I really want to give
something back, but then I read the questions posted, and I really can't
find one that I could answer with precision :P
Anyway, thanks again. Let me know if I have to submit a ticket or something
like that.
El jueves, 21 de mayo de 2015, 15:44:21 (UTC-3), Niphlod escribió:
>
>
>
> On Thursday, May 21, 2015 at 7:13:10 PM UTC+2, Lisandro wrote:
>>
>> Let me post a more detailed example.
>>
>> This is a test with three applications.
>>
>> Two of them ("demo" and "fundapres") use redis to cache the html for
>> default/index, with this decorator (notice empty prefix):
>> @cache.action(time_expire=30, cache_model=cache.redis, session=False,
>> vars=False, public=True, prefix='')
>>
>> The third doesn't directly use redis to cache, but instantiates it to
>> show cache.redis.stats(). Acordingly to documentation, the stats() method
>> "returns a dictionary with statistics of Redis server with one additional
>> key ('w2p_keys') showing all keys currently set from web2py with their TTL"
>> If I don't misunderstand that, w2p_keys shows all keys currently set from
>> web2py for all the installed apps that are using redis.
>>
>
> nope. only the one pertaining to the application.
> https://github.com/web2py/web2py/blob/master/gluon/contrib/redis_cache.py#L265
>
> that being said, I **think** that the issue may be indeed that the
> RedisCache instance is istantiated at the first access. This never happened
> to me (heavy redis user here :-P) because I have only one app per redis
> host.
>
> I'd argue that a fix **can** be (
> https://github.com/web2py/web2py/blob/master/gluon/contrib/redis_cache.py#L68
> and following)
>
> locker.acquire()
> try:
> instance_name = 'redis_instance_' + current.request.application
> if not hasattr(RedisCache, instance_name):
> setattr(RedisCache, instance_name, RedisClient(*args, **vars))
> return getattr(RedisCache, instance_name)
> finally:
> locker.release()
>
>
>
> let me know if it fixes the problem.
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.