I'm writing a set of tools with a web based interface , is a very simple application so I'm going with flask.
One of the tools is a XSL transformer tool where I load a xslt template, a xml file and the tool will return the result of the transformation.
The problem is one of the xslt is very complex, it imports from other xslt and some of them are large.
So I was thinking to implement a singleton like mechanism that loads the lxml transformer instance (the lxml.etree.XSLT) and save this instance on a variable that will be accesible from every request and avoid to make a new instance of this transformer on every request.
My question is, there is a class or something that I can use to create a singleton instance on flask when the application is launched (or deployed)? .
I know a similar mechanism in Java using a @Singleton bean , but I can't find anything on the flask documentation.