Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mashroom/mashroom-browser-cache

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mashroom/mashroom-browser-cache

Mashroom services to control browser caching

  • 1.4.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

Mashroom Browser Cache

Plugin for Mashroom Server, a Integration Platform for Microfrontends.

This plugin adds a Service to manage cache control headers. It allows to disable the cache globally.

Usage

If node_modules/@mashroom is configured as plugin path just add @mashroom/mashroom-browser-cache as dependency.

After that you can use the service like this:

// @flow

import type {MashroomCacheControlService} from '@mashroom/mashroom-browser-cache/type-definitions';

export default async (req: ExpressRequest, res: ExpressResponse) => {

    const cacheControlService: MashroomCacheControlService = req.pluginContext.services.browserCache.cacheControl;
    await cacheControlService.addCacheControlHeader(req, res);

    // ..
};

You can override the default config in your Mashroom config file like this:

{
  "plugins": {
        "Mashroom Cache Control Services": {
            "disabled": false,
            "disabledWhenAuthenticated": false,
            "maxAgeSec": 1800
        }
    }
}
  • disabled: Disable browser caching (default: false)
  • disabledWhenAuthenticated: Disable browser caching when the user is authenticated (default: false)
  • maxAgeSec: Max age in seconds (default: 1800)

Services

MashroomCacheControlService

The Cache Control service is accessible through pluginContext.services.browserCache.cacheControl

Interface:

export interface MashroomCacheControlService {

     /**
      * Add the Cache-Control header based on the settings and authentication status
      */
     addCacheControlHeader(request: ExpressRequest, response: ExpressResponse): Promise<void>;

     /**
      * Remove a previously set Cache-Control header
      */
     removeCacheControlHeader(response: ExpressResponse): void;

}

FAQs

Package last updated on 25 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc