Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to only cache exact queries #35

Open
jonhoo opened this issue Dec 2, 2016 · 1 comment
Open

Option to only cache exact queries #35

jonhoo opened this issue Dec 2, 2016 · 1 comment

Comments

@jonhoo
Copy link

jonhoo commented Dec 2, 2016

Currently, with cache: true, the library will use its cache also for other query strings that are subsets of the user's query. However, this doesn't work for all use-cases. For example, I have an autocomplete field where the server uses the query as an ID to look up a row in the database. Thus, the results from a query like 1022 cannot be re-used to find results for 10228. It would be great if there was a way to specify that the cache must be exact (i.e., that the cache should only be used for lookups, not for searching).

TheCrimsonKing92 pushed a commit to TheCrimsonKing92/JavaScript-autoComplete that referenced this issue Mar 13, 2017
…eries), fixed last readme entry, added documentation for cache option
@TheCrimsonKing92
Copy link

Would you be willing to try the fix I committed to my fork of the repo?

It seemed to me the issue was that the code wouldn't go on to call source when it found empty result sets for "previous values" in its cache, rather than an issue with when values were cached to which key.

As such, setting any non-1 truthy value for cache will now set you to "strict caching", which will bypass the step to check for "previous values" in the cache and proceed to call source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants