How to ignore a parameter in functools. lru_cache?
<p>This is a skeleton of the function I want to enhance with a cache, because doing RPC (remote procedure call) involves a TCP connection to other host.</p>

<pre><code>def rpc(rpc_server, rpc_func, arg):
    return rpc_server.do_rpc(rpc_func, arg)
</code></pre>

<p>However, the most convenient way of simply decorating it with:</p>

<pre><code>@functools.lru_cache()
</code></pre>

<p>does not work well, beacuse <code>rpc_server</code> objects come and go and this parameter should be ignored by the cache.</p>

<p>I can write a simple memoizing code myself. No problem with that. Actually, I see no other solution.</p>

<p>I am unable to rewrite this function in such way that <code>@lru_cache()</code> decorator can be applied <strong>and</strong> <code>rpc_server</code> will be passed as an argument (i.e. I don't want to make <code>rpc_server</code> a global variable). Is it possible?  </p>