Skip to content

[cachetools] Support cache_info on functions #14766

Closed

Description

@brandonchinn178
@ttl_cache()
def foo(x: str) -> int:
    ...

# "Callable[[Any, str], list[str] | None]" has no attribute "cache_info"
print(foo.cache_info())

Related: #11280 #6347

Activity

  1. changed the title [-]Support cache_info on cachetools functions[/-] [+][cachetools] Support cache_info on functions[/+] on Sep 23, 2025
  2. srittau commented on Sep 23, 2025

    @srittau
    Collaborator

    Currently, all the cachetools functions just return IdentityFunction. They should probably return a custom callable class with additional attributes, similar to what functools does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions