Title: Replace lru_cache usage with cache · Issue #35 · scijava/scyjava · GitHub
Open Graph Title: Replace lru_cache usage with cache · Issue #35 · scijava/scyjava
X Title: Replace lru_cache usage with cache · Issue #35 · scijava/scyjava
Description: functools.lru_cache provides a nice way of caching function returns, and is super useful for things like jimport. As @ctrueden noted, however: I think @cache is the nicest. It just implies (rightly so) that function results are cached an...
Open Graph Description: functools.lru_cache provides a nice way of caching function returns, and is super useful for things like jimport. As @ctrueden noted, however: I think @cache is the nicest. It just implies (rightly...
X Description: functools.lru_cache provides a nice way of caching function returns, and is super useful for things like jimport. As @ctrueden noted, however: I think @cache is the nicest. It just implies (rightly...
Opengraph URL: https://github.com/scijava/scyjava/issues/35
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Replace lru_cache usage with cache","articleBody":"[`functools.lru_cache`](https://docs.python.org/3/library/functools.html#functools.lru_cache) provides a nice way of caching function returns, and is super useful for things like [`jimport`](https://github.com/scijava/scyjava/blob/af02aaad23a76cf6b85b4b8039fd1e0ae51f3721/scyjava/__init__.py#L307). As @ctrueden noted, however:\r\n\u003e I think [`@cache`](https://docs.python.org/3/library/functools.html#functools.cache) is the nicest. It just implies (rightly so) that function results are cached and returned again the second time. Whereas `lru_cache(maxsize=None)` is an oxymoron to me: if there is no size limit, it's not \"LRU\" anymore.\r\n\r\nThis is a good point. Unfortunately, `functools.cache` is a feature introduced in Python 3.9, while scyjava requires \u003e=3.6 and tests 3.8\r\n\r\nOnce we move on from these Python versions, we should probably reevaulate the usage of `lru_cache` on `jimport`.","author":{"url":"https://github.com/gselzer","@type":"Person","name":"gselzer"},"datePublished":"2022-03-30T15:21:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/35/scyjava/issues/35"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:445f3a8d-52db-10ce-59ce-f3d8cfeae269 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C1B8:9445B:8A347F:C03E5A:696A813D |
| html-safe-nonce | 19b96b582854355394e722d672b392f7caa4f979b0375694cc4be1857dd234c4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMUI4Ojk0NDVCOjhBMzQ3RjpDMDNFNUE6Njk2QTgxM0QiLCJ2aXNpdG9yX2lkIjoiMzQ0MjUyNDc4MDM4NjQ4NDU0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2335d3563ec672266f8c51fb03efb0fd59c6c4ec605025208fcf8bedb6ae3ce0 |
| hovercard-subject-tag | issue:1186623621 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/scijava/scyjava/35/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8de51ad96d6b1db38a69cf202fb7188bd012022282ecd08be606b1298882c65e/scijava/scyjava/issues/35 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8de51ad96d6b1db38a69cf202fb7188bd012022282ecd08be606b1298882c65e/scijava/scyjava/issues/35 |
| og:image:alt | functools.lru_cache provides a nice way of caching function returns, and is super useful for things like jimport. As @ctrueden noted, however: I think @cache is the nicest. It just implies (rightly... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gselzer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 913560fa317c3c5a71e34f9b19253c9f09d02b4b958a86c2a56f4c8541116377 |
| turbo-cache-control | no-preview |
| go-import | github.com/scijava/scyjava git https://github.com/scijava/scyjava.git |
| octolytics-dimension-user_id | 1262770 |
| octolytics-dimension-user_login | scijava |
| octolytics-dimension-repository_id | 113442144 |
| octolytics-dimension-repository_nwo | scijava/scyjava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 113442144 |
| octolytics-dimension-repository_network_root_nwo | scijava/scyjava |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5998c30593994bf2589055aef7b22d368a499367 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width