Socket
Socket
Sign inDemoInstall

bookshelf-cache-redis

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bookshelf-cache-redis

A robust, performance-focused caching solution for Bookshelf based on top of Redis.


Version published
Weekly downloads
10
increased by400%
Maintainers
1
Install size
7.36 kB
Created
Weekly downloads
 

Readme

Source

Bookshelf Cache Redis

🔥 A robust, performance-focused caching solution for Bookshelf based on top of Redis.

Installation

$ cd myProject/
$ npm install bookshelf-cache-redis --save

Usage

import config from './knexfile';
import knex from 'knex';
import Bookshelf from 'bookshelf';
import redisCache from 'bookshelf-redis-cache';

const bookshelf = Bookshelf(knex(config));

bookshelf.plugin(redisCache);

You can pass the exact same parameters on the fetchCache and fetchAllCache methods as you will do with fetch and fetchAll. However, you need to specify an unique serial key for each request.


Car
 .forge(params)
 .fetchCache({
   serial: 'car_fetch',
   withRelated: ['engine']
 })
 .orderBy('-productionYear') // Same as .orderBy('cars.productionYear', 'DESC')
 .then(function (results) {
    console.log(results);
 });

Keywords

FAQs

Last updated on 13 Jul 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc