[Python] Missing cache statistics for cachedmethod decorator in cachetools

Discussão em 'Python' iniciado por Stack, Março 5, 2025.

  1. Stack

    Stack Membro Participativo

    I am implementing a cached method with cachetools like this:

    class CachedNum(object):

    def __init__(self, cachesize):
    self.cache = LRUCache(maxsize=cachesize)

    @cachedmethod(lambda self: self.cache)
    def get(self, num):
    return num + 1000

    nums = CachedNum(cachesize=10)

    nums.get.cache_info() # This is missing
    nums.cache.cache_info() # The cache itself also has no statistics


    In contrast there are no cache statistics about hits/misses. Is this an oversight in cachetools or do I need to track them myself?

    Continue reading...

Compartilhe esta Página