Closed FrenchBen closed 8 years ago
Hi @FrenchBen. This was a documentation failure. Use cachedRequest.setValue('ttl', 3000)
. I have updated the docs. Thank you!
@danypype What about the mention of the mkdir
not happening for the new cacheDirectory
?
Does the user you're launching the app with, have write access to /tmp
?
indeed it does - If I add the 'mkdirp' above, it all works without any issue. Are you able to use cache when no directory is created on your end?
You can't use cache if the cache directory is not created. I will look further into this.
@FrenchBen try creating the directory yourself, and then launch the app, just to see if you get the same error opening the headers file.
Looking at the code I remembered that the directory isn't created by cached-request
at any time. I will label this as a feature suggestion and implement it. Thank you!
So Error: ENOENT
is actually thrown when writing the headers file.
@FrenchBen also feel free to send a pull request. :)
@danypype Yup same error I got.
Sure can - didn't know if you wanted to add a dependency for mkdirp
using
1.0.0
I can't seem to get my requests to cache. I have the following at the start of my file:When starting my app, I get
cachedRequest.set is not a function
although this is in the docs. Looking at the object it doesn't indeed have aset
method, but does have asetValue
docs need to be updated?Secondly I declare, as seen above, the
cacheDirectory
but keep getting the following error:Looking at the code: https://github.com/alltherooms/cached-request/blob/master/lib/cached-request.js#L164
It seems that there is no check in place to see if the folder should be created - a simple mkdir:
would prevent an anti-pattern and make sure that the dir exists.