Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LRU Cache with maxsize=None #54802

Closed
rhettinger opened this issue Dec 1, 2010 · 3 comments
Closed

LRU Cache with maxsize=None #54802

rhettinger opened this issue Dec 1, 2010 · 3 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@rhettinger
Copy link
Contributor

BPO 10593
Nosy @rhettinger, @ncoghlan
Files
  • cache2.diff: Support maxsize=None
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ncoghlan'
    closed_at = <Date 2010-12-01.03:46:15.204>
    created_at = <Date 2010-12-01.01:01:44.122>
    labels = ['type-feature', 'library']
    title = 'LRU Cache with maxsize=None'
    updated_at = <Date 2010-12-01.03:46:15.203>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2010-12-01.03:46:15.203>
    actor = 'rhettinger'
    assignee = 'ncoghlan'
    closed = True
    closed_date = <Date 2010-12-01.03:46:15.204>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2010-12-01.01:01:44.122>
    creator = 'rhettinger'
    dependencies = []
    files = ['19887']
    hgrepos = []
    issue_num = 10593
    keywords = ['patch']
    message_count = 3.0
    messages = ['122967', '122969', '122977']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'ncoghlan']
    pr_nums = []
    priority = 'low'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue10593'
    versions = ['Python 3.2']

    @rhettinger
    Copy link
    Contributor Author

    Nick, I may have found a straight-forward way to incorporate your idea for the cache to support maxsize=None. Let me know what you think.

    @rhettinger rhettinger added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Dec 1, 2010
    @ncoghlan
    Copy link
    Contributor

    ncoghlan commented Dec 1, 2010

    Nice!

    You may still need to use the lock even for the simple unbounded case though - incrementing hits and misses isn't atomic, so the statistics may be miscounted if you get a hit or miss in different threads at the same time.

    Alternatively, we could just document the hit/miss statistics as approximate figures for tuning purposes rather than guaranteeing 100% accuracy in all situations.

    @rhettinger
    Copy link
    Contributor Author

    Applied in r86911.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants