I am building out a classifier API to insert into our growing platform as a stand-alone service. Basically I want to send over a piece of text and run some proprietary magic on it and respond with a json back.
Easy, right?
Issue is that there are a couple of methods I want to run on the text that require loading big hashes into memory for the operation. Right now, I have to initialize those objects every time I send a new bit of text to be operated on.
What's the best way to set up a global instance of an object that I can access within the controller without having to recreate it for every call?
Should this be in an initializer or is there a way to tie it to a specific controller?