Skip to content

max option must be an integer even if maxAge/ttl is set #193

@mykola-mokhnach

Description

@mykola-mokhnach

Hello,

After upgrading the package to v7 the code started to throw an exception on LRUCache instance creation, because we only provide maxAge value to it, like:

const APPLICATIONS_CACHE = new LRU({
  maxAge: CACHED_APPS_MAX_AGE, // expire after 24 hours
  updateAgeOnGet: true,
  dispose: (app, {fullPath}) => {
    logger.info(`The application '${app}' cached at '${fullPath}' has ` +
      `expired after ${CACHED_APPS_MAX_AGE}ms`);
    setTimeout(async () => {
      if (fullPath) {
        await fs.rimraf(fullPath);
      }
    });
  },
  noDisposeOnSet: true,
});

The error stack trace looks like
https://dev.azure.com/AppiumCI/Appium%20CI/_build/results?buildId=19800&view=logs&j=f164dbd1-368a-58ba-3795-906e0bb83435&t=8e6a9df9-f0b8-5517-a125-44f068bf3227

Please confirm if this is the expected behaviour or the max option must always be provided now even if we only care about TTL

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