Skip to content

Conversation

@cdrini
Copy link
Collaborator

@cdrini cdrini commented Nov 17, 2025

Work towards #11479 . This is now built-in to python and can be replaced with functools.cached_property . It was only used in one spot.

Technical

Added in python 3.8, it has the same semantics as our version, namely that it is store for the life time of the instance:

The cached_property decorator only runs on lookups and only when an attribute of the same name doesn’t exist. When it does run, the cached_property writes to the attribute with the same name. Subsequent attribute reads and writes take precedence over the cached_property method and it works like a normal attribute.

Testing

Screenshot

Stakeholders

Copilot AI review requested due to automatic review settings November 17, 2025 22:44
Copilot finished reviewing on behalf of cdrini November 17, 2025 22:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes the codebase by replacing a custom cached_property implementation with Python's standard library functools.cached_property (available since Python 3.8).

  • Removes the custom cached_property decorator function (22 lines of code)
  • Updates the single usage in MemcacheCache.memcache to use functools.cached_property
  • Removes cached_property from the module's __all__ exports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants