[web2py] Re: what is in the cache ?

2016-11-22 Thread Niphlod
in redis terms (which will set an expire timing accordingly) doesn't make 
much sense. 

In the default implementation, which never expires anything, time_expire=0 
basically means "update that key".

On Monday, November 21, 2016 at 4:30:07 PM UTC+1, Pierre wrote:
>
> I understand  use-cases for 
> time_expire=None
>
>
> but I don't see a use-case for 
> time_expire=0
>
>
>
> when you do  
> cache.redis('message', lambda: 'Hello', time_expire=0)
>
> all the subsequent *cache.redis('message',)* will overwrite Hello
>
> to get a persistent Hello you have to write something like:
>
> cache.redis('message', None)
> cache.redis('message',lambda: 'Hello', time_expire=None)
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: what is in the cache ?

2016-11-21 Thread Pierre
I understand  use-cases for 
time_expire=None


but I don't see a use-case for 
time_expire=0



when you do  
cache.redis('message', lambda: 'Hello', time_expire=0)

all the subsequent *cache.redis('message',)* will overwrite Hello

to get a persistent Hello you have to write something like:

cache.redis('message', None)
cache.redis('message',lambda: 'Hello', time_expire=None)

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: what is in the cache ?

2016-11-20 Thread Niphlod
goes to redis, obviously! and redis usually stores it into ram (although it 
usually saves a copy to the disk, which is configurable, but just to not 
make it totally volatile between restarts of redis)

On Friday, November 18, 2016 at 12:21:05 PM UTC+1, Pierre wrote:
>
> Yes I improved my understanding of the cache system since the last 
> message. now writing a component to make sure i can integrate this 
> thing..
>
> where does *cache.redis* goes : ram or disk ?
>
> thanks
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: what is in the cache ?

2016-11-18 Thread Pierre
Yes I improved my understanding of the cache system since the last message. 
now writing a component to make sure i can integrate this thing..

where does *cache.redis* goes : ram or disk ?

thanks

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: what is in the cache ?

2016-11-17 Thread Niphlod
read CAREFULLY http://web2py.com/books/default/chapter/29/04/the-core#cache 
.

Unfortunately (?) web2py's cache isn't "the usual" cache object, as it's 
designed to store indefinitely values that do not expire automatically. 
Basically time_expire vouches to either fetch the stored value or to update 
the one already in cache.

time_expire=None forces the retrieval of the stored value, without updating 
it, so you MAY use it for your usecase.

NB: The redis backend needs to adhere to the same API web2py has, but 
leverages redis evictions postponing a bit the real expiration.


On Wednesday, November 16, 2016 at 2:53:52 PM UTC+1, Pierre wrote:
>
> how do I retrieve a key,value pair stored in the redis cache ?
>
> am doing this :
>
> message = cache.redis('message', lambda: 'Hello', time_expire=360)
>
>
> now i want to test that key='message' still exists and get its value ?
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.