Skip to content

Use one instance of NodeCache per DB collection... #306

Open
@LucasBrazi06

Description

I would like to use the TTL at NodeCache's instance level and not per record.

Then I'll be notified only once when the instance data is expired and I will reload ALL the cache at once.

When instance is created, the TTL provided is applied to the instance

    const nodeCache = new NodeCache( {
      instanceTTL: 600,   // Instance TTL
      checkperiod: 100,
    });

This notification should be called only once after instance expiration and I will put the code here to reload the whole cache:

    nodeCache.on( "instance_expired", (instance: NodeCache) => {
        // Reload the whole cache here from the DB
    });

Is it possible?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions