adding base class for context functions who are caching the result
commit for #264