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

Add cache #11

Open
jperelli opened this issue Feb 18, 2020 · 2 comments
Open

Add cache #11

jperelli opened this issue Feb 18, 2020 · 2 comments
Labels
feature new feature to be added

Comments

@jperelli
Copy link
Owner

jperelli commented Feb 18, 2020

Think on how to add a directory/redis/memcache cache so that this can be used as a <img src="..."> tag more efficiently. Maybe add a cache param like

  • cache=directory:path
  • cache=redis:url
  • cache=memcache:url
    and maybe use another param like cache_force_refresh=true to refresh cache, or a timeout like cache_timeout to expire old elements saved in cache

this module looks good enough https://www.npmjs.com/package/cache-manager
and this one to build the key from the options object https://www.npmjs.com/package/json-stable-stringify

@jperelli jperelli added the feature new feature to be added label Feb 18, 2020
@pascalroget
Copy link

pascalroget commented Feb 18, 2020

as in - caching the binary images? If so, this will probably need an expires param as well

@jperelli
Copy link
Owner Author

jperelli commented Feb 18, 2020

Right, caching the binary images using the params (or hash of params) as key of the cache. That way only the first time the image is generated, but the next times is requested, the library just uses the cache to get and return the image fast.

And yes, I'll add an expires or timeout param for it to be auto purged

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

No branches or pull requests

2 participants