[Python-ideas] Clear all caches

Serhiy Storchaka storchaka at gmail.com
Wed Apr 1 15:41:20 CEST 2015


On 01.04.15 16:27, Paul Moore wrote:
> On 1 April 2015 at 13:28, Serhiy Storchaka <storchaka at gmail.com> wrote:
>> I proposed to add two functions (in some existing lightweight module or add
>> a new module):
>>
>> clear_caches(level=0)
>> register_cache(level, clear_func)
>>
>> clear_caches() calls cache clearing functions for specified level and
>> larger.
>
> I'm not sure I understand how "level" would be used. Presumably
> anything registering a cache has to decide what level it wants to be
> at, but how should it decide? Maybe there should be some standard
> levels defined? Is there actually a need for a level parameter at all?

All this can be discussed here. It is just an idea, I'm not sure about 
any details. Right now the level parameter is not needed to me, but may 
be other developers will need it.

May be the behavior should be opposite: clear caches of specified level 
and *lower*. Then by default only level 0 will be cleared and users will 
be able to use higher levels for long-living caches.




More information about the Python-ideas mailing list