GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use one instance of NodeCache per DB collection... · Issue #306 · node-cache/node-cache

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

New issue
Copy link
New issue
Copy link
Open
Open
Use one instance of NodeCache per DB collection...#306
Copy link

Description

@serge-fabiano
serge-fabiano
opened on May 3, 2023
Issue body actions

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?

Activity

  1. deepam-kapur commented on May 5, 2023

    @deepam-kapur
    deepam-kapur
    on May 5, 2023
    More actions

    Can I work on this?

  2. AggelosAst commented on Aug 28, 2023

    @AggelosAst
    AggelosAst
    on Aug 28, 2023
    More actions

    From what i understood, this is what youre asking for:

    const nodeCache1 = new NodeCache( {
         stdTTL: 600,   // TTL for nodeCache1 
         checkperiod: 100,
    });
    
    const nodeCache2 = new NodeCache( {
         stdTTL: 400,   // TTL for nodeCache2
         checkperiod: 100,
    });
    
    // . . .
    
    nodeCache2.on( "key_expired", (key, value) => {
           //  . . .
    });
    
    nodeCache1.on( "key_expired", (key, value) => {
           //  . . .
    });

    And, yes thats possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.