Better parsing and caching

I changed the parsing of the content field, like described in mark's pull request. I also added caching and a routine to refresh the cache of a resource if the resource get's updated.
Works well in my tests, but might need some more testing.