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

vsm-dictionary-cacher

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vsm-dictionary-cacher - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "vsm-dictionary-cacher",
"version": "1.0.0",
"version": "1.0.1",
"description": "Wrapper around a VSM-dictionary, that manages a cache of string-match results",

@@ -5,0 +5,0 @@ "main": "src/DictionaryCacher.js",

@@ -7,3 +7,4 @@ # vsm-dictionary-cacher

`vsm-dictionary-cacher` is a wrapper around VSM-dictionaries.
`vsm-dictionary-cacher` is a wrapper around VSM-dictionaries,
to speed up requests for string-matches in three ways:

@@ -13,18 +14,34 @@ - It stores results from requests to `getMatchesForString()` in a cache.

that use same search-string & options, instead of re-running the query.
This helps e.g. `vsm-autocomplete` avoid making duplicate requests to an
online dictionary server.
That creates a more responsive autocomplete when the user
types, backspaces, and types again.
- In addition, it remembers for which strings there were no matches.
> This helps e.g. `vsm-autocomplete` avoid making duplicate requests to an
online dictionary server.
It creates a more responsive autocomplete when the user
types, and then backspaces.
- It also prevents launching a second query to a server, that has the same
search-string & options as an ongoing query.
Instead, it makes the second query wait, and when the first one's result
comes in, it shares that result immediately with the second one.
> This helps e.g. `vsm-autocomplete` avoid making duplicate requests
when a user types, and backspaces or re-types quickly.
- And it can remember for which strings there were no matches.
Then for subsequently queried strings, that start with such a 'no matches'
string, it can immediately return 'no matches' too.
> This helps e.g. `vsm-autocomplete` avoid making unnecessary requests
for search-strings for which a substring already returned no matches.
<br>
This package provides a factory function that accepts any VsmDictionary class,
and returns a subclass of it,
which simply adds an extra layer of caching functionality
to `getMatchesForString()`.
<br>
## Use
This package provides a factory function that accepts any VsmDictionary class, and returns a subclass of it
that simply has an extra layer of caching functionality.
Install like:

@@ -90,3 +107,3 @@ ```

Use like:
Specify options like:
```

@@ -93,0 +110,0 @@ const CachedDictionary = cacher(Dictionary, { maxItems: 100, maxAge: 180000 });

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