solr-client-cache
Installation
This module is distributed using npm which comes bundled with node:
npm install --save solr-client-cache
Usage
const solr = require('solr-client');
const solrCache = require('solr-client-cache');
const client = solr.createClient();
solrCache(client, {
ttl: 60,
engine: 'redis',
host: '127.0.0.1',
port: 6379
});
client
.cache()
.search(query, (err, results) => { });
client
.search(query, (err, results) => { });
If you want a different TTL (Time to Live) for a specific query, then pass it to the cache()
function.
const solr = require('solr-client');
const solrCache = require('solr-client-cache');
const client = solr.createClient();
solrCache(client, { ttl: 60 });
client
.cache(10)
.search(query, (err, results) => { });
All cache options (TTL, engine, etc...) are described on cacheman README.
Test
Just run:
npm test
License
MIT