Skip to content

bc::memoize: support caching more than one result at a time #23

@waptaff

Description

@waptaff

Hi,

I was a bit saddened when I realized that bc::memoize would only keep the freshest invocation in memory:

foo() { … } && bc::memoize foo

foo 3 # Runs cold, normal.
foo 3 # Runs memoized, cool.
foo 4 # Runs cold, normal.
foo 4 # Runs memoized, cool.
foo 3 # Runs cold, sadly.
foo 4 # Runs cold, sadly.

It appears bc::cache supports the above usage pattern, but OTOH polluting the filesystem with files (and I/O) is not very appealing for my use case.

I'm curious, is there some fundamental reason that would make supporting the above usage pattern in bc::memoize a headache?

Thanks for your library, it really fills one of the many bash gaps — I can almost do away with function static variables thanks to you :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions