Variables defined outside of the handler are cached - does this work for objects? I want to cache a client class but not sure how.
I need to instantiate the class from inside the handler because I need data from the event for the constructor. Can I define a var for it outside the handler and store it there like this?
from . import myclass
myobj = None
def lambda_handler(event):
myobj = myclass.MyClass(event)
myobj is set to None because I need to set a var to something correct? It won't get reset to None every invocation, will it? I want to cache the instantiated object which takes the event in its constructor.