Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

how to cache a nodejs method in nodeservices #462

Closed

Description

@AnyListen

consider this : i have a jsvascript file (cmd5.js), it is a little bigger
when i call the method in this file using below code;
I am doubtful about that the mothod will reload cmd5.js everytime, so this is less efficient;
how to be more efficient

_nodeServices.InvokeExportAsync<string>("./Node/cmd5", "qymd5", input).Result;

Activity

  1. SteveSandersonMS commented on Nov 25, 2016

    @SteveSandersonMS
    Member

    It doesn't reload your file every time :) We keep the same Node instance alive (unless it has to restart because a .js file on disk changed), and Node itself keeps the modules' compiled code in memory for reuse every time that module is referenced.

    So, in effect, it's already cached in the way you want.

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