Type Alias LockFactorySettingsBase

LockFactorySettingsBase: {
    context?: IReadableContext;
    createLockId?: Invokable<[], string>;
    defaultRefreshTime?: ITimeSpan;
    defaultTtl?: ITimeSpan | null;
    serde?: OneOrMore<ISerderRegister>;
    serdeTransformerName?: string;
}

Base configuration shared by all LockFactory variants.

IMPORT_PATH: "@daiso-tech/core/lock"

Type declaration

  • Optionalcontext?: IReadableContext

    You can pass IReadableContext that will be used by context-aware adapters.

    import { ExecutionContext } from "@daiso-tech/core/execution-context"
    import { NoOpExecutionContextAdapter } from "@daiso-tech/core/execution-context/no-op-execution-context-adapter"

    new ExecutionContext(new NoOpExecutionContextAdapter())
  • OptionalcreateLockId?: Invokable<[], string>

    You can pass your own lock id generator function.

    import { v4 } from "uuid";

    () => v4
  • OptionaldefaultRefreshTime?: ITimeSpan

    The default refresh time used in the ILock refresh method.

    import { TimeSpan } from "@daiso-tech/core/time-span";

    TimeSpan.fromMinutes(5);
  • OptionaldefaultTtl?: ITimeSpan | null

    You can decide the default ttl value for ILock expiration. If null is passed then no ttl will be used by default.

    import { TimeSpan } from "@daiso-tech/core/time-span";

    TimeSpan.fromMinutes(5);
  • Optionalserde?: OneOrMore<ISerderRegister>

    You can pass an ISerderRegister instance to the LockFactory to register the lock's serialization and deserialization logic for the provided adapter.

    import { Serde } from "@daiso-tech/core/serde";
    import { NoOpSerdeAdapter } from "@daiso-tech/core/serde/no-op-serde-adapter";

    new Serde(new NoOpSerdeAdapter())
  • OptionalserdeTransformerName?: string

    The registered serde transformer name used to identify lock serializer and deserializer adapters when there are adapters with the same name.

    ""