Skip to content

Can I access the cache across different script? #312

@tungrix

Description

@tungrix

Let's say I am declaring an obj in test1.js.

const NodeCache = require( "node-cache" );
const myCache = new NodeCache( { stdTTL: 100, checkperiod: 120 } );

obj = { my: "Special", variable: 42 };
 
success = myCache.set( "myKey", obj, 10000 );

Is it possible to access "myKey" in test2.js during running?

If yes, how can I do it?

If not, how to access "myKey" in some child nested functions? Through multiple passing as the parameter?

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