Re: [Twisted-Python] Caching mechanism

2009-11-16 Thread Marco Giusti
On Mon, Nov 09, 2009 at 06:24:20PM -0500, vit...@synapticvision.com wrote: > > Such global variable(lets say dictionary) will have any size limit? i don't know what kind of method calls do you need to cache, but what about of memcached? twisted got a really handy client api for memcached and, you

Re: [Twisted-Python] Caching mechanism

2009-11-16 Thread mardiros
Here is the main part of my code class CacheCleanerBaseMixin: def __init__(self, cachetimer,cachelifetime): self._cache = {} self._cachelifetime = timedelta(0,cachelifetime) self._cleaner = task.LoopingCall(self.cleanCache) self._cleaner.start(cachetimer,now=False) self._cleanrun = False def cle

Re: [Twisted-Python] Caching mechanism

2009-11-15 Thread mardiros
Hi, you can couple a decorator with the maybeDeferred function. this is a trivial example but it works. This cache is not cleaned and if you write your decorator in a class with a __call__ function, you can isolate the cache dictionary and a configurable lifetime, with a twisted.internet.task.Loo

Re: [Twisted-Python] Caching mechanism

2009-11-09 Thread Andy Fundinger
Twisted doesn't enforce any, that's part of the effect of you actually writing the server, defining, enforcing, and adhering to those limits is left to the developer. Of course you have a limited amount of space in your machine, and you probably don't want to use swap, but nothing twisted is going

Re: [Twisted-Python] Caching mechanism

2009-11-09 Thread vitaly
Such global variable(lets say dictionary) will have any size limit? Quoting "Andy Fundinger" : > 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 likel

Re: [Twisted-Python] Caching mechanism

2009-11-09 Thread Kevin Horn
On Mon, Nov 9, 2009 at 4:47 PM, Paul Hubbard wrote: > > Both of the links from pypi are dead, alas. Do you know if that > project is alive somewhere else? > > Cheers, > Paul > > There's something that's probably similar here: http://code.activestate.com/recipes/498245/ Kevin Horn ___

Re: [Twisted-Python] Caching mechanism

2009-11-09 Thread Andy Fundinger
No, clue, but I've sent the code to you off list and if anyone else wants it I'd be glad to do the same. Andy On Mon, Nov 9, 2009 at 5:47 PM, Paul Hubbard wrote: > > Both of the links from pypi are dead, alas. Do you know if that > project is alive somewhere else? > > Cheers, > Paul > > > On No

Re: [Twisted-Python] Caching mechanism

2009-11-09 Thread Paul Hubbard
Both of the links from pypi are dead, alas. Do you know if that project is alive somewhere else? Cheers, Paul On Nov 9, 2009, at 2:42 PM, Andy Fundinger wrote: > Part of the beauty of twisted is that you don't actually need to do > anything > special to achieve that, just create a global d

Re: [Twisted-Python] Caching mechanism

2009-11-09 Thread Andy Fundinger
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.pytho

Re: [Twisted-Python] Caching mechanism

2009-11-09 Thread exarkun
On 07:28 pm, vit...@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). There's not r

Re: [Twisted-Python] Caching mechanism

2009-11-09 Thread vitaly
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 exar...@twistedmatrix.com: > On 05:41 pm, vit...

Re: [Twisted-Python] Caching mechanism

2009-11-09 Thread exarkun
On 05:41 pm, vit...@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 possibili