Skip to content

Replace repoze.lru.lru_cache with functools.lru_cache - #75

Open
henri-hulski wants to merge 1 commit into
masterfrom
lru_cache
Open

henri-hulski wants to merge 1 commit into
masterfrom
lru_cache

Conversation

@henri-hulski

Copy link
Copy Markdown
Member

Also fixed the registry tests and added tests for the cache.

@henri-hulski henri-hulski changed the title Replace rpoze.lru with functools.lru_cache Replace repoze.lru with functools.lru_cache Sep 30, 2026
@coveralls

coveralls commented Sep 30, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — lru_cache into master

@henri-hulski henri-hulski changed the title Replace repoze.lru with functools.lru_cache Replace repoze.lru.lru_cache with functools.lru_cache Sep 30, 2026

@Daverball Daverball left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, I only have a small suggestion.

Comment thread reg/cache.py Outdated
Comment on lines +91 to +94
def _all(key: Sequence[Any]) -> list[_ValueT]:
return list(key_lookup.all(key))

self.all = lru_cache(all_cache_size)(_all)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
def _all(key: Sequence[Any]) -> list[_ValueT]:
return list(key_lookup.all(key))
self.all = lru_cache(all_cache_size)(_all)
@lru_cache(all_cache_size)
def _all(key: Sequence[Any]) -> list[_ValueT]:
return list(key_lookup.all(key))
self.all = _all

Might as well use the decorator syntax here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure! Looks cool...

@henri-hulski
henri-hulski force-pushed the lru_cache branch 2 times, most recently from 1e05e13 to 4060ff8 Compare October 1, 2026 19:35
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.

3 participants