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

@express.ts/cache

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@express.ts/cache

test package

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

@express.ts/cache

A simple in-memory cache for @express.ts

Installation

npm install @express.ts/cache --save

Usage

Test.ts

import { Cache } from "@express.ts/cache";

export class Test {

  protected value = Date.now();

  getExecutionTime () {
    return Date.now() - this.value;
  }

  @Cache(1000) // 1s
  getExecutionTimeWithCache () {
    return Date.now() - this.value;
  }

}

App.ts

import { Test } from "./Test";

const testInstance = new Test();

console.log([ // [ 4, 4 ]
  testInstance.getExecutionTime(),
  testInstance.getExecutionTimeWithCache()
]);

console.log([ // [ 24, 4 ]
  testInstance.getExecutionTime(),
  testInstance.getExecutionTimeWithCache()
]);

setTimeout(() => {
  console.log([ // [ 1038, 1038 ]
    testInstance.getExecutionTime(),
    testInstance.getExecutionTimeWithCache()
  ]);
}, 1001)

FAQs

Package last updated on 05 Aug 2019

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