Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

solr-client-cache

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solr-client-cache

Caching for Solr Client

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

solr-client-cache

Caching module for solr-client using cacheman.

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
});

// search Solr with cache
client
  .cache()
  .search(query, (err, results) => { /* ... */ });

// search Solr without cache
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 });

// search Solr with cache
client
  .cache(10) // 10 seconds TTL instead of 60s
  .search(query, (err, results) => { /* ... */ });

All cache options (TTL, engine, etc...) are described on cacheman README.

Test

Just run:

npm test

License

MIT

Keywords

FAQs

Package last updated on 03 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc