[Twisted-Python] Caching mechanism

Andy Fundinger Andy at NewWorldElectric.com
Mon Nov 9 17:42:27 EST 2009


Part of the beauty of twisted is that you don't actually need to do anything
special to achieve that, just create a global dict or other object of your
choice and access it as needed.  More likely what you need to look for is a
cache expiration mechanism, I've linked in lrucache (
http://pypi.python.org/pypi/lrucache/0.2) in one case, but usually I just
write my own constraints as appropriate.

It's often misunderstood, but in twisted you are writing an actual server
rather than just some methods for servicing requests.  The server will run
until stopped and all global or even local variables will remain in memory
unless deleted or dereferenced and garbage collected.  Rather than doing
something special to get a persistent variable you need to do something
special when you want a non-persistent one.

-Andy

On Mon, Nov 9, 2009 at 2:28 PM, <vitaly at synapticvision.com> wrote:

>
>
> Caching the results of some particular method calls, so other server
> side methods can access those results (I'm thinking about example of
> global variable per entire server, so once imported, such variable
> content could be access).
>
>
>
> Quoting exarkun at twistedmatrix.com:
>
> > On 05:41 pm, vitaly at synapticvision.com wrote:
> >> hi,
> >> is there any cache mechanism for twisted? Could one point me please to
> >> that docs?
> >
> > What sort of caching are you interested in?  Caching the results of
> > method calls?  A caching HTTP proxy?  Caching in the DNS client?  The
> > total list of possibilities could run to many pages. :)
> >
> > Jean-Paul
> >
> > _______________________________________________
> > Twisted-Python mailing list
> > Twisted-Python at twistedmatrix.com
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> >
>
>
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



-- 
Blog:  http://channel3b.wordpress.com

Drinking good coffee makes you wise, drinking bad coffee only makes you
awake.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20091109/2fc33294/attachment.htm 


More information about the Twisted-Python mailing list