Message249447
> 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) |
|
Date |
User |
Action |
Args |
2015-09-01 02:57:05 | rhettinger | set | recipients:
+ rhettinger, r.david.murray, Marek Otahal |
2015-09-01 02:57:05 | rhettinger | set | messageid: <1441076225.24.0.396567365368.issue24969@psf.upfronthosting.co.za> |
2015-09-01 02:57:05 | rhettinger | link | issue24969 messages |
2015-09-01 02:57:04 | rhettinger | create | |
|