Excellent suggestion! Done in cache now. Please give it a try and let
us know if that is fine.

Massimo

On Dec 26, 5:27 am, Iceberg <[email protected]> wrote:
> Hi Massimo,
>
> This snippet of code causes web2py 1.54 to halt.
>
> model.py:
> testdb=SQLDB("sqlite://test.db")
> testdb.define_table('Test',
>   SQLField('whatever','string'))
>
> controller.py:
> @cache('abc',time_expire=6,cache_model=cache.ram)
> def test():
>   logging.warn('calling')
>   whatever=testdb().select(testdb.Test.ALL,cache=(cache.ram,3600))
>   if not session.counter:
>     session.counter=0
>   session.counter+=1
>   return {1:session.counter}
>
> If I omit either call of cache, the snippet works fine.
>
> You may ask why I need nesting cache in my application.  Because my
> real controller.py looks like this:
> def getAllRawData(): # This helper function is called by many other
> actions, so I need a cache in it
>   return testdb().select(testdb.Test.ALL,cache=(cache.ram,3600))
>
> @cache('abc',time_expire=6,cache_model=cache.ram)
> def annualStat():
>   teams=getAllRawData()
>   result=doSomeComplexCalculationBasedOn( teams ) # I hope to cache
> the result of this too.
>   return result
>
> Eliminate the nesting cache usage may be an option, but it will be
> more intuitive if I do not have to do so. Can web2py support nesting
> cache style?
>
> Thanks.
> Iceberg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to