Partial implementation for #6
Prevent from crashes when url doesn't exists

Cherry picked from 3655b79..0d62434
Merge branch '0.1' into 0.2
Merge branch '0.2'
Check for errors when writing to socket

Fix for #3
Merge branch '0.2'
Make caching API asynchronous

Closes #5
Fix undefined reference in async cache handling
Fix a couple of E_NOTICE errors on missing array indices