Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use cache simply !? #24

Open
drupalshift opened this issue Aug 20, 2016 · 0 comments
Open

How to use cache simply !? #24

drupalshift opened this issue Aug 20, 2016 · 0 comments

Comments

@drupalshift
Copy link

drupalshift commented Aug 20, 2016

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);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant