All Projects â†’ strapi â†’ bookshelf-cache-redis

strapi / bookshelf-cache-redis

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

Programming Languages

javascript
184084 projects - #8 most used programming language

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);
 });
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].