1.3.4 • Published 1 year ago

always-up v1.3.4

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Installation

To install the package, use:

npm i always-up

UI Component

To use the UI component in a React application:

  1. Import the CachingPopup component:

    import { CachingPopup } from "always-up/cachingpopup";
  2. Use it directly as a React component:

    <CachingPopup />

Middleware

To use the middleware in your server application:

  1. Import the createCacheMiddleware function:

    import { createCacheMiddleware } from "always-up/createcachemiddleware";
  2. In server.js, create and use the cache middleware:

    const cacheMiddleware = createCacheMiddleware(
      {
        maxMemorySizeInMB: 350,
        upperMemoryLimitPercentage: 97,
        lowerMemoryLimitPercentage: 75,
        syncToDiskIntervalInSeconds: 60,
        storageFilePath: "path/to/cache.json", //Path to Where file is to be stored
      },
      "path/to/cache.log", //Log File Path
      "path/to/alwaysUpConfig.json" //Log to UI Configs
    );
    app.use(cacheMiddleware);