durusmail: quixote-users: Caching?
Caching?
2003-08-27
2003-08-27
2003-08-28
2003-08-28
2003-08-29
Re: Caching?
2003-08-28
Caching?
Jason Sibre
2003-08-28
Well, without seeing a code sample, it's hard to see exactly what you have
in mind, but yes, I'd definitely plan on using a dictionary as the
underlying storage scheme.  If you're concerned about performance (and I'm
guessing you are, since we're talking about caching) you might want to
consider maintaining a list of tuples of (expiration_time, cache_key) that
you can move through in sequence (until reaching the first item you don't
want to expire yet) and expire cache entries that way instead of by looping
through ALL the items in the cache looking for expiration candidates.  On
the other hand, maybe you don't imagine you cache growing large enough for
that to be a concern.

On the other hand, I think Graham's point (about squid) is a very good
one...  That's what caching proxies are designed for, and if you do things
that way, you'll be implementing a cache technique that's proven, and more
universal (and truly takes the load off your server).

Jason

> -----Original Message-----
> From: quixote-users-bounces+jsibre=chironsys.com@mems-exchange.org
> [mailto:quixote-users-bounces+jsibre=chironsys.com@mems-exchange.org]On
> Behalf Of Dan Gottlieb
> Sent: Wednesday, August 27, 2003 8:30 PM
> To: quixote-users@mems-exchange.org
> Subject: Re: [Quixote-users] Caching?
>
>
> Jason,
>
> Thanks for your thoughts.  I was hoping someone with more Python
> experience
> had built something I could work off of, but if my work load
> eases up in the
> next few days I'll probably take a crack at putting together a caching
> mechanism myself.  My inclination would be to use a dictionary with global
> scope for the actual cache, matching cache keys with a tupples of
> expiration
> times and html strings and then periodically loop through and
> remove expired
> items.  Is this a good way to structure things?  I'd appreciate any advice
> that you have.
>
> - Dan
>
>
> ----- Original Message -----
> From: "Jason Sibre" 
> To: 
> Sent: Tuesday, August 26, 2003 9:08 PM
> Subject: RE: [Quixote-users] Caching?
>
>
> > > Is there an equivalent caching module for Quixote?
> > >
> > > Also, much of what the new app will be doing is finding URLs in a
> > > database
> > > based on the querystring and then sending redirects to the client.
> > > Obviously, I'd like to cache the key / URL pairs after they
> are used the
> > > first time.  Is there an easy way to do this with Quixote?
> >
> >
> > Dan,
> >
> > While there isn't (to my knowledge) a caching module per se in
> Quixote, it
> > would be very easy to implement, and there are a number of ways it could
> be
> > done.  The first that comes to mind would be sub-classing the Publisher
> > class to implement a CachingPublisher, which, upon seeing a familiar URL
> > could return the cached version of the data without even going
> through the
> > URL traversal stage.  Another would be to subclass Publisher to make it
> call
> > a caching proxy when it's ready to publish an
> object/namespace/function/etc,
> > and let the proxy have a crack at serving a cached version, or fetching
> the
> > real thing.  I'm sure there are lots of ways to do this,
> (probably two or
> > three for each person using Quixote!) but I think most or all of high
> > performance ones would involve subclassing the Publisher.  I don't know
> how
> > familiar you are with the source, (but I'm assuming you aren't very
> familiar
> > with it) but this is really an easy proposition.
> >
> > On your second point, if you mean something like
> > "http://server.org/goto?url=http://somedocserver/doc.txt" gets looked up
> to
> > be routed to some other url, this would be easy to do, results could be
> > cacheable, and you wouldn't have to modify the Quixote framework in any
> way.
> >
> > Of course, you'd have to implement the caching mechanism yourself, (it
> > wouldn't magically happen as I suspect it does in .NET), and
> you'd have to
> > deal with issues like cache expiry, cache size limitations, and the like
> > when you come up with your implementation.  Also, caching would
> be useless
> > (performance wise) if the Quixote process isn't some form of
> long running
> > process (FastCGI, SCGI, running standalone as Medusa, or
> Twisted, etc...)
> > but I'm guessing that's obvious...  Just wanted to throw it out there in
> > case it isn't.  I don't know your environment, so I don't know
> how tricky
> > that might be to pull off.  (Having worked in MS shops before, I know
> > sometimes it's impossible to get admins to let you set up 'crazy things'
> > (anything not from Redmond) on 'their' servers!)
> >
> > Hope that helps, and if not, stick around, I'm sure some other
> folks with
> > have interesting comments on this.
> >
> > Jason Sibre
> >
> >
> > _______________________________________________
> > Quixote-users mailing list
> > Quixote-users@mems-exchange.org
> > http://mail.mems-exchange.org/mailman/listinfo/quixote-users
> >
> >
>
>
>
> _______________________________________________
> Quixote-users mailing list
> Quixote-users@mems-exchange.org
> http://mail.mems-exchange.org/mailman/listinfo/quixote-users
>


reply