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

Add cache.function method #5

Merged
merged 20 commits into from
Jan 6, 2020
Merged

Add cache.function method #5

merged 20 commits into from
Jan 6, 2020

Commits on Dec 1, 2019

  1. Configuration menu
    Copy the full SHA
    2d33249 View commit details
    Browse the repository at this point in the history
  2. 2.0.0-0

    fregante committed Dec 1, 2019
    Configuration menu
    Copy the full SHA
    f64791f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    dade8d0 View commit details
    Browse the repository at this point in the history
  4. 2.0.0-1

    fregante committed Dec 1, 2019
    Configuration menu
    Copy the full SHA
    b3c3bfb View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a2b5ef0 View commit details
    Browse the repository at this point in the history
  6. Revert package.json

    fregante authored Dec 1, 2019
    Configuration menu
    Copy the full SHA
    ea909c6 View commit details
    Browse the repository at this point in the history
  7. Shorten types /2

    fregante authored Dec 1, 2019
    Configuration menu
    Copy the full SHA
    40bb4f1 View commit details
    Browse the repository at this point in the history
  8. Shorten and fix types

    Now `function_` has to return a valid value. `undefined` isn't a valid value
    fregante committed Dec 1, 2019
    Configuration menu
    Copy the full SHA
    a94e9c8 View commit details
    Browse the repository at this point in the history
  9. Make cache.set return the value itself

    This lets you simplify the code from:
    
    ```js
    const foo = await generate();
    await cache.set('key', foo);
    return foo;
    ```
    
    to:
    
    ```js
    return set('key', await generate());
    ```
    fregante committed Dec 1, 2019
    Configuration menu
    Copy the full SHA
    ec128fa View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    ee9799b View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2019

  1. Lint

    fregante committed Dec 2, 2019
    Configuration menu
    Copy the full SHA
    7ab8bcc View commit details
    Browse the repository at this point in the history

Commits on Dec 7, 2019

  1. Configuration menu
    Copy the full SHA
    04a5dce View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a5a7202 View commit details
    Browse the repository at this point in the history
  3. Update some TS deps

    fregante committed Dec 7, 2019
    Configuration menu
    Copy the full SHA
    aaacbfe View commit details
    Browse the repository at this point in the history

Commits on Jan 6, 2020

  1. Only support async functions (TypeScript types)

    This enables easy overloads support.
    
    Disk caching helps functions that take a while to execute and sync functions generally don't.
    
    If necessary, a user-side solution would be:
    
    ```ts
    cache.function(async x => syncFunction(x))
    ```
    
    There's no way to support overloads on sync functions: https://stackoverflow.com/q/59125705/288906
    
    Types could be fixed to at least support overloaded async functions but I couldn't figure out how.
    fregante committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    426a04e View commit details
    Browse the repository at this point in the history
  2. Add documentation

    fregante committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    cada340 View commit details
    Browse the repository at this point in the history
  3. Fix types

    fregante committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    01b371d View commit details
    Browse the repository at this point in the history
  4. Fix build

    fregante committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    6dc5025 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    aceb673 View commit details
    Browse the repository at this point in the history
  6. Fix readme

    fregante committed Jan 6, 2020
    Configuration menu
    Copy the full SHA
    0d9b488 View commit details
    Browse the repository at this point in the history