From: Jonathan S. <sw...@po...> - 2001-12-14 15:55:19
|
Looks like your cache can be written to, but not read from. Strange. Try switching to another DBM implementation and see if that changes things. When you do "make test", does your cache test fail? > -----Original Message----- > From: mas...@li... > [mailto:mas...@li...]On Behalf Of Skip > Montanaro > Sent: Thursday, December 13, 2001 6:37 PM > To: mas...@li... > Subject: RE: [Mason] caching is working, yet not working > > > > Regarding my inability to get caching working, Jonathan wrote: > > Simplify your example to isolate the problem. First thing I > would do is > make sure you can get $m->cache working in a trivial way > (with key 'foo' > and no expiration). Next make sure $m->cache_self works in the same > trivial way. > > so I wrote the following simple component: > > <pre> > <% $key %> > </pre> > <%args> > $key=>[] > </%args> > <%init> > my $results = $m->cache; > > if (defined($results)) { > $key = $results; > } else { > if (ref($key)) { > $key = join("/", @{$key}) > } > $m->cache(action=>'store', value=>$key); > } > </%init> > > Suppose I first access it as > > http://staging.musi-cal.com/foo?key=junk&key=food > > I should see "junk/food" in my browser window. On subsequent accesses I > expect to also see "junk/food", regardless of the number of key parameters > or their values, because "junk/food" was cached and should always be > retrieved (default key, no expiration info), right? What I see is the > current values bound to $key, never what's in the cache. > > Plowing ahead anyway, I converted it to use $m->cache_self: > > <pre> > <% $key %> > </pre> > <%args> > $key=>[] > </%args> > <%init> > return if $m->cache_self; > > if (ref($key)) { > $key = join("/", @{$key}) > } > </%init> > > Same result. It never appears that the cached results are used, > though the > cache is written. Whenever I look at the data in the cache: > > >>> db = bsddb.hashopen("musi-cal+2fstaging+2ffoo") > >>> for k in db.keys(): > ... v = db[k] > ... print k, `v` > ... > main.contents > '\x04\x04\x041234\x04\x04\x04\x08\x04\x02\x02\x00\x00\x00\n\x1f<pr > e>\njunk/food/walnuts\n</pre>\n\x05' > main.expires '\x04\x04\x041234\x04\x04\x04\x08\x08\x80' > main.lastmod '\x04\x04\x041234\x04\x04\x04\x08\x06\xdf^\x19<' > > I always see the last set of key parameters with which I accessed the > component. > > Am I missing something? > > Skip > > _______________________________________________ > Mason-users mailing list > Mas...@li... > https://lists.sourceforge.net/lists/listinfo/mason-users |