kadirahq/lokka

How to use cache simply !?

Opened this issue · 0 comments

Sorry for newbie question , I'm trying use Lokka in my project here is how i managed to get data from GraphQl , is there any simple way i can cache results for a fixed period of time ( server side ) so when ever I'm using client.query Lokka gets data from cache instead of transport !?

var Lokka = require('lokka').Lokka;
var Transport = require('lokka-transport-http').Transport;

var client = new Lokka({
  transport: new Transport('http://graphql-swapi.parseapp.com/')
});

function getFilms(req, res) {
    client.query(querym).then(function(result) {
        res.render('index', { movies: result });
    }).catch(function(err) {
        console.log(err.message);
    })
}

router.get('/', function(req, res) {
    getFilms(req ,res);
});