Thank you for all for all the answers so far, particularly to Ilya and
Jean-Paul who provided some very helpful code samples.
It's interesting to realise that, by avoiding locking, we can end up
with a much more efficient implementation. I'll have to figure out how
widely we can apply this
Thanks for correction, Jean-Paul, you're absolutly right
пн, 12 мар. 2018 г. в 23:00, Jean-Paul Calderone :
> On Mon, Mar 12, 2018 at 3:52 PM, Ilya Skriblovsky <
> ilyaskriblov...@gmail.com> wrote:
>
>> Hi, Richard,
>>
>> I've used class like this to cache the result
On Mon, Mar 12, 2018 at 3:52 PM, Ilya Skriblovsky wrote:
> Hi, Richard,
>
> I've used class like this to cache the result of Expensive Calculation:
>
> class DeferredCache:
> pending = None
> result = None
> failure = None
>
> def __init__(self,
Hi, Richard,
I've used class like this to cache the result of Expensive Calculation:
class DeferredCache:
pending = None
result = None
failure = None
def __init__(self, expensive_func):
self.expensive_func = expensive_func
def __call__(self):
if self.pending
Hi Richard,
On March 12, 2018 at 1:49:41 PM, Richard van der Hoff (rich...@matrix.org)
wrote:
Hi folks,
I thought I'd poll the list on the best way to approach a problem in
Twisted.
The background is that we have a number of resources which can be
requested by a REST client, and which are
Hi folks,
I thought I'd poll the list on the best way to approach a problem in
Twisted.
The background is that we have a number of resources which can be
requested by a REST client, and which are calculated on demand. The
calculation is moderately expensive (can take multiple seconds), so