vsm-dictionary-cacher
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"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 }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35206
159