Storing published objects (?)
Hello All, I'm not sure if the title accurately reflects what I want to do. I have a DTML method that uses a number of other objects and generates HTML code (the usual). What I'd like to do is assign/save the HTML code the method generates. I'd like to save the HTML as a BLOB in a database, and next time a user calls up a particular report, if the source data hasn't changed, publish the pre-rendered HTML. The underlying SQL queries are complex, the data doesn't change often, and I think this may be the best way to lighten the burden on the DB. Is this possible? If so, how would I go about accomplishing this? Perhaps there's a better way of accomplishing this? Thanks in advance. Regards, Samir
Samir Mishra wrote:
The underlying SQL queries are complex, the data doesn't change often, and I think this may be the best way to lighten the burden on the DB.
Hmmm, well generally this is what CacheManagers do, but storing the results in a database would be a new one (to date I've seen managers that use memory, the filesystem, and just add HTTP headers to the response). While its entirely likely you could achieve what you want using a memory cache, if the data is sufficiently large it may be not be a good idea, and its certainly not persistent accross zope-restarts. Implementing a cache manager that stored its data in a RDBMS shouldn't be impossible, take a look at the Cache & CacheManager interfaces in OFS/Cache.py -- and I'd suggest using the updated code I've prepared in http://collector.zope.org/Zope/911 as its cleaner than the existing stuff. -- Jamie Heilman http://audible.transient.net/~jamie/ "It's almost impossible to overestimate the unimportance of most things." -John Logue
participants (2)
-
Jamie Heilman -
Samir Mishra