Implemented template loader with block type cache.

Also, partially ported cache with tests (no LRU).