Sounds nasty.
reading from the disk will always be faster than querying that database again.
It seems the following should work for you then?
t=cache.ram('from_sql_server',lambda:cache.disk('from_sql_server',
lambda:myobject(),time_expire=5),time_expire=5)
This way if its not in ram, it checks the disk, if its not on the
disk, it will query the server (which takes 30 seconds, but then
everything will be cached)
Then if you needed updated data from the database you could
cache.ram.clear() cache.disk.clear()
-Thadeus
On Mon, Feb 1, 2010 at 10:18 AM, Mark Larsen <[email protected]> wrote:
>> Why not use a chained cache.disk inside a cache.ram.
>
> I think I like just using the cache.ram and pre-loading each
> processes. The structure is large and I'm not sure how reading from
> disk (especially with a fair amount of users) would affect
> performance. I'm going to have to profile this when I get there.
> Both are good options to try.
>
>> I'm curious, what is the object your trying to cache ? I would think
>> any object that had to persist in a thread-safe way like your
>> requirements should be redesigned and stored in a database.
>
> This data is actually coming from a database. The problem is it's a
> poorly designed archived away, massive beast running on an antiquated
> server that is slow, slow, and did I mention slow. Simple selects
> take 30 seconds as opposed to the fractions of seconds they should
> take. Goods new for me though is I only need to read from this
> database (and it updates very infrequently), so I was going to
> pre-cache the data I need into an object and get it from there. Note
> that this is not my applications database but is a linked server using
> sql server 2005.
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" 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.
>
>
--
You received this message because you are subscribed to the Google Groups
"web2py-users" 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.