[Issue 294] Add pluggable in-memory caching

This pull request is related to the issue #294.