Type Alias DefaultStorageOptions<Context>

DefaultStorageOptions<Context>: Readonly<{
    maxSize: number;
    ttl?: number;
    cacheKey?(context: Context): unknown;
}>

Type Parameters

  • Context = void

Type declaration

  • maxSize: number

    Maximum number of stored streams. When this number is reached - the oldest stream from the oldest accessed Context gets removed.

  • Optionalttl?: number

    If present and non-zero - a TTL timeout in milliseconds for stored streams.

  • cacheKey?:function
    • Get a cache key from a given Context. Useful when context object is rich and not unique, but a sub-property of it (e.g. context.path) uniquely represents the cached value.

      Parameters

      • context: Context

        Typically a file path, but could be an arbitrary object.

      Returns unknown

      An arbitrary string or object to be used as a key for an Map