if instantiating the object takes time Joe's approach is absolutely correct
IMHO.  One must avoid  caching  per-thread or per-process data in the
singleton unless explicitly managed with proper locking/message passing.
So to speed up more one can use cache.ram or cache.disk or memcache or
redis ... to also cache output, reducing also the impact on db and
rendering as Leonel suggest, while delegating the complexity of managing
context data to web2py caching.

2015-05-06 5:47 GMT+02:00 Joe Barnhart <joe.barnh...@gmail.com>:

> I don't want to cache the entire output of the function.  If I do that,
> the cache will include the data in the table.  I just want to save the
> object that generates the table and apply new data to it for each user /
> swimmer / whatever.
>
> Had I used cache.ram on this table, it would have made Natalie Coughlin's
> times a permanent feature of the cached output.  With the Singleton
> approach, I can click on Michael Phelps name and re-use the same object
> that generates the table, but with different table contents.
>
> With cache.ram, I would eventually cache separate versions of the table
> for every swimmer I ever looked at.  Or at least within the given cache
> timeframe.
>
>
> On Tuesday, May 5, 2015 at 5:42:41 PM UTC-7, Leonel Câmara wrote:
>>
>> Why not just use cache ram?
>>
>  --
> 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.
>

-- 
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.

Reply via email to