New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@hyper63/port-cache

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyper63/port-cache

hyper63 service framework port for cache adapters

latest
Source
npmnpm
Version
1.1.4
Version published
Maintainers
1
Created
Source

Cache Port

The cache port takes an adapter and environment, then parses the adapter and wraps function validations around each function.

Your adapter or composed adapter should implement all specified functions:

export default (env) => ({
  createStore,
  destroyStore,
  createDoc,
  getDoc,
  updateDoc,
  deleteDoc,
  listDocs,
});

You can create a test for your adapter with the port like so:

import { default as test } from "tape";
import { default as cache } from "@hyper63/ports-cache";
import { default as redis } from "@hyper63/adapters-redis";

test("certify adapter", async (t) => {
  t.plan(3);
  const instance = cache(redis, { url: "redis://redis:6379" });
  const store = "default";
  t.ok((await instance.createStore("default")).ok);
  t.ok(
    (
      await instance.createDoc({
        store: "default",
        key: "hello",
        value: { foo: "bar" },
      })
    ).ok
  );
  t.deepEqual((await instance.getDoc({ store: "default", key: "hello" })).doc, {
    foo: "bar",
  });
});

FAQs

Package last updated on 08 Jun 2021

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