ixfx
    Preparing search index...

    Type Alias PoolOptions<V>

    Pool options

    type PoolOptions<V> = {
        capacity?: number;
        capacityPerResource?: number;
        debug?: boolean;
        free?: (v: V) => void;
        fullPolicy?: FullPolicy;
        generate?: () => V;
        resourcesWithoutUserExpireAfterMs?: number;
        userExpireAfterMs?: number;
    }

    Type Parameters

    • V
    Index

    Properties

    capacity?: number

    Maximum number of resources for this pool

    capacityPerResource?: number

    Maximum number of users per resource. Defaults to 1

    debug?: boolean

    If true, additional logging will trace activity of pool. Default: false

    free?: (v: V) => void

    If specified, this function will be called when a resource is disposed

    fullPolicy?: FullPolicy

    What to do if pool is full and a new resource allocation is requested. Default is error, throwing an error when pool is full.

    generate?: () => V

    If specified, this function will generate new resources as needed.

    resourcesWithoutUserExpireAfterMs?: number

    If above 0, resources with no users will be automatically removed after this interval. Default: disabled

    userExpireAfterMs?: number

    If above 0, users will be removed if there is no activity after this interval. Activity is marked whenever use us called with that user key. Default: disabled