This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

cache-driver
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Cache Driver

About

Inspired by the PHP package Onoi Cache, this package aims to help make other packages less dependent on specific caching packages.

Installation

npm install cache-driver --save

Usage (Packages)

This section is if you're adding this driver to your package. It also assumes you're using TypeScript.

import { Cache } from "cache-driver"
 
export class MyAwesomeClass {
    private cache: Cache|null = null;
 
    constructor(cache?: Cache) {
        if (cache) {
            this.cache = cache;
        }
    }
 
    public someMethod() {
        if (this.cache !== null) {
            this.cache.save("sessionId", "somerandomstring", 2);
        }
    }
}

Usage (Product) Untested

This is assuming you're using MyAwesomeClass from above as well as TypeScript. This also assumes you're using the cache package.

Install cache

npm install cache --save
import { CacheAdapter } from "cache-driver/lib/adapters/CacheAdapter"
 
let awesome = new MyAwesomeClass(new CacheAdapater());

Package Sidebar

Install

npm i cache-driver

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

4.88 kB

Total Files

7

Last publish

Collaborators

  • matthewh