Skip to content

In memory cache (localforage) size is ignored #4630

Closed
@lkrzyzanek

Description

@lkrzyzanek

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

By defining the localforage cache like this, the size is ignored:

cache:
  localforage:
    name: "my-cache"
    size: 1000
    storeName: "my-cache-store"

To Reproduce
Configure localforage as described above and then check the size of the mesh cache. It's always 4980736 which is default size for localforage.

The bug is here: https://github.com/Urigo/graphql-mesh/blob/master/packages/cache/localforage/src/index.ts#L13
config.size is simply not used at all.
Then creation of InMemoryLRU https://github.com/Urigo/graphql-mesh/blob/master/packages/cache/localforage/src/InMemoryLRUDriver.ts#L15 has options.size = 4980736 and not 1000

Expected behavior

size should be 1000.

It also be very very useful if Mesh will log info about current configuration of the cache. Now there is no mention about cache at all.

Environment:

  • OS: Mac OSX
  • @graphql-mesh/cli: 0.78.28
  • NodeJS: 16

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