Introducing function cache class
Adding unit-tests for internal calls