[Python-ideas] Clear all caches

Eric Snow ericsnowcurrently at gmail.com
Wed Apr 1 17:17:16 CEST 2015


On Wed, Apr 1, 2015 at 8:58 AM, Alexander Walters
<tritium-list at sdamon.com> wrote:
> Why not just take a dbapi approach to this; define an api, build things to
> that api in the standard library, but leave it to third parties to use it.
> "Does your module have a cache?  define these methods somewhere, and
> anything that manages cache will know how to deal with it".  No global
> registry, not global manager in the standard library, just an api.

What Serhiy is proposing is a mechanism for clearing a bunch of caches
at once.  So you need a registry of caches that are included in that
operation.  With just a protocol, Serhiy's goal would have to be
accomplished by somehow scanning through all live objects for those
that implement.  An explicit opt-in mechanism is both more efficient
and friendlier.

-eric


More information about the Python-ideas mailing list