This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients Marek Otahal, r.david.murray, rhettinger
Date 2015-09-01.02:57:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1441076225.24.0.396567365368.issue24969@psf.upfronthosting.co.za>
In-reply-to
Content
> The problem is I can't know the optimal values for 'maxsize',
> I need to set them at runtime. 

The easiest way to go is to wait to start caching until you know the cache size you want:
   
   def foo(a, b, c):
        pass

   size = get_user_request()
   foo = lru_cache(foo, maxsize=size)

If there is a subsequent need to change the cache size, just rewrap it:

   size = get_user_request()
   original_function = foo.__wrapped__
   foo = lru_cache(foo, maxsize=size)
History
Date User Action Args
2015-09-01 02:57:05rhettingersetrecipients: + rhettinger, r.david.murray, Marek Otahal
2015-09-01 02:57:05rhettingersetmessageid: <1441076225.24.0.396567365368.issue24969@psf.upfronthosting.co.za>
2015-09-01 02:57:05rhettingerlinkissue24969 messages
2015-09-01 02:57:04rhettingercreate