Cachios GET example, differing query params

node v6.17.1
version: 2.0.0
endpointsharetweet
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
const cachios = require('cachios'); const url = 'http://example.com/'; const logStats = promise => promise.then(() => console.log(cachios.cache.getStats())); // should be miss (hits = 0, misses = 1) await logStats(cachios.get(`${url}?country_code=fr-fr`)); // should also be miss (hits = 0, misses = 2) await logStats(cachios.get(`${url}?country_code=de-de`)); // should be hit (hits = 1, misses = 2) await logStats(cachios.get(`${url}?country_code=fr-fr`)); // should be hit (hits = 2, misses = 2) await logStats(cachios.get(`${url}?country_code=de-de`));
Loading…

no comments

    sign in to comment