Hi all, I have idea about another caching method in Zope. I am very sorry if it exist, but I dont know that. If I have for example very expensive or manytimes called method, I cannot cache it via RAM cache manager, because it gives the same output regardless place from where are calling. For example, two methods: siteroot <dtml-var BASE1>/ localroot <dtml-in "PARENTS[3:]">../</dtml-in> (3 because I use virtual servers as zoperoot/www/domain ) So siteroot can be cached via RAM cache manager without no problems, because constructing URLs are <dtml-var siteroot>images/imege.gif output will http://www.domain.com/images/imege.gif But localroot could not be cached, because i receive bad locations: <dtml-var localroot>images/imege.gif output will ../../images/imege.gif If localroot are cached, then output of that will be same regardless of calling directory, it is computed from first access. So it is possible to do "dynamic" caching? What I mean, is store all localroot objects in context of calling direcotry (or another object). I have few hundreds of calling localroot per page and I will be hapy if it will have some solution for that. I dont want migrate to siteroot because it makes absolute URLs, not relative. I know, I could use squid and Accelerated cache manager as reverse cache for caching whole pages, but it is not wanted solution (because you cannot see immediatelly changes to pages). Many thanks for tips or implementation ;-) Regards J. Lukesh
Hi, --On Mittwoch, 23. Oktober 2002 11:26 +0100 Jaroslav Lukesh <lukesh@k-net.cz> wrote:
Hi all, ....
For example, two methods:
siteroot <dtml-var BASE1>/
localroot <dtml-in "PARENTS[3:]">../</dtml-in> I dont think your example serves very well because the cache lookup would be comparable to this simple calculation, may be the cache lookup is even costyer.
....
So it is possible to do "dynamic" caching? What I mean, is store all localroot objects in context of calling direcotry (or another object).
You can define one or more request variables as "key" for different object versions (RAM Cache manager), so you can use PARENTS here as well.
I have few hundreds of calling localroot per page and I will be hapy if it will have some solution for that. I dont want migrate to siteroot because it makes absolute URLs, not relative.
if localroot is a python script, you could use something like this: if request.has_key('_mylocalroot'): return request.get('_mylocalroot') localroot=... request.set('_mylocalroot',localroot) return localroot
I know, I could use squid and Accelerated cache manager as reverse cache for caching whole pages, but it is not wanted solution (because you cannot see immediatelly changes to pages).
Sure you can. Both cache managers support "invalidation" of cached entries if the object changes. For RAM Cache its normal behavior and for Accelerated cache manager you have to give the URL to the proxy for it to work - and the rights for the server where your Zope lives.
Many thanks for tips or implementation ;-)
Further, you are constructing links like <someroot>/more/path/elements Do you think this is useful? You could either use /path/from/your/root (without servername) or object_to_link_to.absolute_url() which gives you the whole string. If you are using VirtualHostMonster and friends, you dont have to worry about wrong servernames. HTH Tino Wildenhain
Jaroslav Lukesh writes:
I have idea about another caching method in Zope. I am very sorry if it exist, but I dont know that. ... RAM Cache Managers allow for distinquishing variables:
The same object can have several cached values if the variable tuple are different. I never used it myself. Thus, I cannot tell you the details. Dieter
participants (3)
-
Dieter Maurer -
Jaroslav Lukesh -
Tino Wildenhain