cache cfunction result, add test case from tutorial