[web2py] Re: @cache decorator

2013-04-23 Thread BlueShadow
Just to wrap this up:

So here is what I did to solve my problem (data is added once a day, time 
to render the result page takes forever):
The function which gets the data got appended by: cache.disk.clear() and 
cache.ram.clear()
I used the unix crantab to call that function once a day via a curl command.
the display function is called 1-2 minutes later and cached for 24 hours.
I removed the datestring although it would make no diffrence, but its just 
unnessassary.
It works like a charm now I got load times down from 30sekonds to about 5 
(there are some graphics rendered from the data via matplotlib).

Thanks for all the help 

-- 

--- 
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/groups/opt_out.




[web2py] Re: @cache decorator

2013-04-22 Thread Derek
Yes, that was my question. If it doesn't include the time, then it should 
work fine.

On Thursday, April 18, 2013 11:59:53 AM UTC-7, Anthony wrote:
>
> Note, the cache doesn't do anything to clear out old items, so if you 
> change the key every day, the previous day's page will still remain in the 
> cache. You might want to do something to purge the old page out of the 
> cache.
>
> Also, are you absolutely sure returnDatestring() is returning only the 
> date and not also the time?
>
> Anthony
>
> On Thursday, April 18, 2013 1:17:26 PM UTC-4, BlueShadow wrote:
>>
>> So you are basicly saying I did exactly what I wanted to do save the 
>> entire generated page on disk.
>> So how can I find out what is taking so long for the page to load?
>>
>> @Derek: thats easy: I want the page cached from 00:05 to 23:59. because 
>> every day at midnight the data changes. if for some reason the page is 
>> cached later than 00:05 (I got a cronjob with a curl to visit that page) 
>> the new version will be calculated regardless of whether there is still a 
>> cached version or not. (because the date changes)
>>
>> On Thursday, April 18, 2013 6:41:37 PM UTC+2, Paolo valleri wrote:
>>>
>>> Basically it stores the output of the function, in your case the output 
>>> is the rendered view.
>>> For more info about cache, have a look here: 
>>> http://web2py.com/books/default/chapter/29/04#cache
>>>
>>> Paolo
>>>
>>>

-- 

--- 
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/groups/opt_out.




[web2py] Re: @cache decorator

2013-04-18 Thread Anthony
Note, the cache doesn't do anything to clear out old items, so if you 
change the key every day, the previous day's page will still remain in the 
cache. You might want to do something to purge the old page out of the 
cache.

Also, are you absolutely sure returnDatestring() is returning only the date 
and not also the time?

Anthony

On Thursday, April 18, 2013 1:17:26 PM UTC-4, BlueShadow wrote:
>
> So you are basicly saying I did exactly what I wanted to do save the 
> entire generated page on disk.
> So how can I find out what is taking so long for the page to load?
>
> @Derek: thats easy: I want the page cached from 00:05 to 23:59. because 
> every day at midnight the data changes. if for some reason the page is 
> cached later than 00:05 (I got a cronjob with a curl to visit that page) 
> the new version will be calculated regardless of whether there is still a 
> cached version or not. (because the date changes)
>
> On Thursday, April 18, 2013 6:41:37 PM UTC+2, Paolo valleri wrote:
>>
>> Basically it stores the output of the function, in your case the output 
>> is the rendered view.
>> For more info about cache, have a look here: 
>> http://web2py.com/books/default/chapter/29/04#cache
>>
>> Paolo
>>
>>

-- 

--- 
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/groups/opt_out.




[web2py] Re: @cache decorator

2013-04-18 Thread Niphlod
for starters check the "cache" page in appadmin (go to "database 
administration", then click "cache" at the top) to see hot many hits/misses 
you find.
In a "perfect world" ( i.e. your cache works as expected) you'd have 1 miss 
and n-1 hits with n being the number of times your page is accessed.

On Thursday, April 18, 2013 7:17:26 PM UTC+2, BlueShadow wrote:
>
> So you are basicly saying I did exactly what I wanted to do save the 
> entire generated page on disk.
> So how can I find out what is taking so long for the page to load?
>
> @Derek: thats easy: I want the page cached from 00:05 to 23:59. because 
> every day at midnight the data changes. if for some reason the page is 
> cached later than 00:05 (I got a cronjob with a curl to visit that page) 
> the new version will be calculated regardless of whether there is still a 
> cached version or not. (because the date changes)
>
> On Thursday, April 18, 2013 6:41:37 PM UTC+2, Paolo valleri wrote:
>>
>> Basically it stores the output of the function, in your case the output 
>> is the rendered view.
>> For more info about cache, have a look here: 
>> http://web2py.com/books/default/chapter/29/04#cache
>>
>> Paolo
>>
>>

-- 

--- 
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/groups/opt_out.




[web2py] Re: @cache decorator

2013-04-18 Thread BlueShadow
So you are basicly saying I did exactly what I wanted to do save the entire 
generated page on disk.
So how can I find out what is taking so long for the page to load?

@Derek: thats easy: I want the page cached from 00:05 to 23:59. because 
every day at midnight the data changes. if for some reason the page is 
cached later than 00:05 (I got a cronjob with a curl to visit that page) 
the new version will be calculated regardless of whether there is still a 
cached version or not. (because the date changes)

On Thursday, April 18, 2013 6:41:37 PM UTC+2, Paolo valleri wrote:
>
> Basically it stores the output of the function, in your case the output is 
> the rendered view.
> For more info about cache, have a look here: 
> http://web2py.com/books/default/chapter/29/04#cache
>
> Paolo
>
>

-- 

--- 
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/groups/opt_out.




[web2py] Re: @cache decorator

2013-04-18 Thread Derek
Why would you be using 'returnDatestring + Somepage' as your key to the 
cache?


On Thursday, April 18, 2013 9:17:36 AM UTC-7, BlueShadow wrote:
>
> Hi I got a site which calls some major calculating. So I thought lets use 
> the cache decoator to speed up second time loads.
> But it doesnt seem to have any effekt on pageloading times.
> @cache(returnDatestring()+"Somepage", time_expire=86000, cache_model=cache
> .disk)
> def Somepage():
> #some time intensive calculations
> return response.render(l=l)
>
> So with and without the @cache decorator it takes about 25 seconds for the 
> page to load. (yeah my server is slow I know) As far as I understand it the 
> whole age should be stored on the disk and be served as a static page. 
> which should load instantly.
> Or is just the output of the function stored and the view has to be 
> rendered afterwards? (the view has a big table with like 100 rows, there 
> are calculated some sums too)
> If so can I cache the entire view?
>

-- 

--- 
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/groups/opt_out.




[web2py] Re: @cache decorator

2013-04-18 Thread Paolo valleri
Basically it stores the output of the function, in your case the output is 
the rendered view.
For more info about cache, have a look here: 
http://web2py.com/books/default/chapter/29/04#cache

Paolo

On Thursday, April 18, 2013 6:17:36 PM UTC+2, BlueShadow wrote:
>
> Hi I got a site which calls some major calculating. So I thought lets use 
> the cache decoator to speed up second time loads.
> But it doesnt seem to have any effekt on pageloading times.
> @cache(returnDatestring()+"Somepage", time_expire=86000, cache_model=cache
> .disk)
> def Somepage():
> #some time intensive calculations
> return response.render(l=l)
>
> So with and without the @cache decorator it takes about 25 seconds for the 
> page to load. (yeah my server is slow I know) As far as I understand it the 
> whole age should be stored on the disk and be served as a static page. 
> which should load instantly.
> Or is just the output of the function stored and the view has to be 
> rendered afterwards? (the view has a big table with like 100 rows, there 
> are calculated some sums too)
> If so can I cache the entire view?
>

-- 

--- 
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/groups/opt_out.