If I am using N/Cache on the user event side, how ...
# suitescript
s
If I am using N/Cache on the user event side, how do I get it on the client? If a shared library is used on a client and a user event, would it be better to use session? Pre-loading lookup data
n
N/Cache is server side only. If you want it client side, you can dump it into a hidden field and read it on the client side. Not really the best solution, this is a kludge I put together when I was a junior consultant, so I can't really recommend this. Obviously, don't do this with sensitive data. A more elegant solution might exist by using a Suitelet to access the cache data. Never tried.
s
This would be on a restlet so it would be server side. a Restlet is called which then triggers a map/reduce to import 20mb of data
n
I'm not 100% on what you're trying to do, but my pattern would be to 1. Save the file to the file cabinet 2. Pass the ID of the saved file into the map/reduce 3. use the map/reduce to load the file in the getinput stage and parse it so the map/reduce stages can process as needed 4. Either confirm that everything has been processed correctly, then delete, or have a script that purges downloaded files that are X hours/days old
s
The problem is, the file cabinet has a limit of 10mb. We're way over that
So the only thing I can do, if I use a file, is create multiple files 😕
n
what type of file?
s
json
or a text file. don't remember
n
if it's straight text, just calculate how big it is pre-emptively and save it in chunks
s
that's what I'd like to avoid, but I may not be able to
avoid doing that, that is
n
yeah, that's the way I'd do it. I don't have any clever solutions to get around that, but in my experience, "clever" blows up in my face 9 times out of 10 🙂